Software Archive
Read-only legacy content
Announcements
FPGA community forums and blogs on community.intel.com are migrating to the new Altera Community and are read-only. For urgent support needs during this transition, please visit the FPGA Design Resources page or contact an Altera Authorized Distributor.

Systemqq

Intel_C_Intel
Employee
1,228 Views
I tried using systemqq to launch winword, as follows:

l4 = systemqq('winword c:myfile.doc')

Apparently no success, as winword is not launched. However,
l4 is returned as .TRUE.

Was ist los?

LKD
0 Kudos
10 Replies
Steven_L_Intel1
Employee
1,228 Views
winword would have to be in your PATH to make this work.

Have you considered the ShellExecute API routine? You could use it to "open" the document. I have used this many times with great success. It will automatically open the document using the default associated with the file type, including web pages!

Steve
0 Kudos
Intel_C_Intel
Employee
1,228 Views
Ah yes, the path. Actually, I did use the complete path, but still no luck. I still can't figure out why winword is not launched. However, your suggestion to use ShellExecute is a much better idea, and I will try it later today.
lkd
P.. If I weren't already using CVF, I would certainly buy it based on the great support!
0 Kudos
Steven_L_Intel1
Employee
1,228 Views
If the complete path had spaces in it, you would need to enclose the path in "".

Steve
0 Kudos
Intel_C_Intel
Employee
1,228 Views
Tried ShellExecute today. Here is the command I used:

i4 = ShellExecute( GetHWndQQ(QWIN$FRAMEWINDOW), "OPEN", "c:2maxents.DOC", " ", " ", %VAL(0) )

i4 = 31 upon return. (No association for this file extension). I'm running all this under Win2000. I checked my associations. Indeed DOC is registered to Word.

What should I do next to figure out what the real problem is?

lkd
0 Kudos
Steven_L_Intel1
Employee
1,228 Views
ShellExecute is a Win32 routine, so all strings must be C strings - for example, "OPEN"C.

Steve
0 Kudos
Intel_C_Intel
Employee
1,228 Views
Yes, and so my MSDN documentation said. This was my first attempt:

i4 = ShellExecute( GetHWndQQ(QWIN$FRAMEWINDOW), "OPEN"C, "c:2maxents.DOC"C, " "C, " "C, %VAL(0) )

Returned i4 = 2 (File not found).

And my third attempt, assuming that I couldn't pass a null-terminated string in such an implicit way, was this:

str1 = "OPEN"C
str2 = "c:2maxents.DOC"C
str3 = ""C

i4 = ShellExecute( GetHWndQQ(QWIN$FRAMEWINDOW), str1, str2, str3, str3, %VAL(0) )

Returned i4 = 2 as above.

Question remains: Do you have any hints for debugging this?

lkd
0 Kudos
Intel_C_Intel
Employee
1,228 Views
This works

i4 = ShellExecute( GetHWndQQ(QWIN$FRAMEWINDOW), "OPEN"C, "2maxents.DOC"C, ""C, "c:"C, %VAL(0) )

This does not work

i4 = ShellExecute( GetHWndQQ(QWIN$FRAMEWINDOW), "OPEN"C, "c:2maxents.DOC"C, ""C, ""C, %VAL(0) )
0 Kudos
nijhuis
Beginner
1,228 Views
LSD,

Your real problem is the backlash in the -string. "2" is a correct escape sequence in a -string and has the decimal value 2.
You should use a double backlash in the string: "I:2maxents.DOC"I

Gnus
0 Kudos
nijhuis
Beginner
1,228 Views
LKD,

Sorry for the prior message. I misused the Spell Check.

Your real problem is the backslash in the C-string. "2" is a correct escape sequence in a C-string and has the decimal value 2.
You should use a double backslash in the string: "C:2maxents.DOC"C

Guus
0 Kudos
Intel_C_Intel
Employee
1,228 Views
Thanks Guus, that was EXACTLY the problem!

lkd
0 Kudos
Reply