Re: call of ShellExecuteEx causes error message

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



Thanks, I will do that. However, I already saw in the debugger that the
correct color information of the Photoshop image was communicated.

Well, I am now trying to do this communication in a new way, no more with
the lpParameters string of ShellExecuteInfo, but with socket communication.

Please look at my new question:
how to wait for socket communications

Thanks!


"Ali" wrote:

On May 13, 11:03 am, Ananya <Ana...@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote:
Well, it's not networking on the internet, it's simply trying to make a
connection between my C++ and my Java program. Is this the right forum for
my question?
My Java program brings up its own window and is for drawing curves, and my
C++ program makes it a plugin to Photoshop

Ok, here is some code:
char o[5] = "open";
char a[43] = "C:\\Dev\\AnanyaCurves0.new\\AnanyaCurvesW.exe";

//define pix vector from Photoshop image
vector<int> pix;
int pixCount = w*h; /width times height of image

...// correct code for getting pixels array

unsigned int red, green, blue;
int pixint;
for (int y = 0; y < h; y++)
{
for (int x = 0; x < w; x++)
{
red = pixels[y*w+x];
green = pixels[pixCount + y*w+x];
blue = pixels[2*pixCount + y*w+x];}

pixint = 0xff000000 | ((red<<16) + (green<<8) + blue);
pix.push_back(pixint);

}
}

//make string from pix vector
string str;
string countstr = convertIntToString(pixCount);
str = countstr + " ";
string pixstring;
for (i = 0; i < pixCount; i++)
{
pixstring = convertIntToString(pix[i]);
str+= pixstring + " ";}

str = str + "\0";
const char *s = str.c_str(); // get const char * representation

//call ShellExecuteEx
SHELLEXECUTEINFO ei = {0};
ei.cbSize = sizeof(ei);
ei.fMask = SEE_MASK_NOCLOSEPROCESS;
ei.lpVerb = o;
ei.lpFile = a;
ei.lpParameters = s;
ei.nShow = SW_NORMAL;
ShellExecuteEx(&ei);

Thanks for looking at my code! Please let me know if you need more code,
such as my code for locking and unlocking handles. As I said before, when I
give other information for the string s, ShellExecute works, it just doesn't
work for the pix vector information, but the pix vector is correct.

"Ali" wrote:
On May 13, 5:20 pm, Ananya <Ana...@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote:
I am using ShellExecuteEx to call a Java native executable from my C++ program.

When, for the lpParameters of SHELLEXECUTEINFO, I just gave some simple
information, the call of ShellExecuteEx worked.

But when I added the color information of all pixels of an image (even if
the image is as small as 18x18 pixels), I get the following error message
with my Java executable name in the title:
Windows cannot access the specified device, path, or file. You may not have
the appropriate permissions to access the item.

However when I just double click on my Java executable, it does run.

So what am I doing wrong?

Thanks for your time!

Huh! and how exactly it is related to networking? are you trying to
call shell over internet?
Copy/paste your code so folks around here would point the exact
problem.

ali

Frankly, i can't see anything wrong with your code;-) Ananya , i'll
strongly recommend to use file technique for testing purpose as it
will makeyour life easy to debug both applications.

for (i = 0; i < pixCount; i++)
{
pixstring = convertIntToString(pix[i]);
str+= pixstring + " ";
}

str = str + "\0";

WRITE your 'str' to some file for example pix.txt, and now call the
shell.

ShellExecuteEx(&ei);


By doing above you can always open your input file (pix.txt) to
observe the data,

ali


.



Relevant Pages

  • Conceptual - Communication between Objects
    ... // Interface to ensure that all communication based objects implement the ... void Output; ... public abstract class ObjectBase: ICommunication ... protected string m_name; ...
    (microsoft.public.dotnet.languages.csharp)
  • Re:
    ... > patterns to split a string. ... > It is odd about the help files, after I figure out how to do something, the ... > distribution or copying of this communication is strictly prohibited. ...
    (comp.lang.python)
  • RE:
    ... patterns to split a string. ... It is odd about the help files, after I figure out how to do something, the ... distribution or copying of this communication is strictly prohibited. ...
    (comp.lang.python)
  • Re: rs232? Again....
    ... This parameter tells you how many bytes could have been read from the communication port within the given time limits. ... Reading from the serial port means reading a stream of bytes, not a string. ... Thus you don't get a Null terminator that is usually used in C++ to delimit strings, but only the raw bytes that represent the characters of your string. ... Most of these classes are just very, very thin wrappers around the standard way of communicating with serial ports via the Win32 API functions CreateFile, WriteFile, ReadFile, and CloseHandle. ...
    (microsoft.public.vc.language)