Re: call of ShellExecuteEx causes error message



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

  • Re: call of ShellExecuteEx causes error message
    ... My Java program brings up its own window and is for drawing curves, ... //define pix vector from Photoshop image ... //make string from pix vector ... the call of ShellExecuteEx worked. ...
    (microsoft.public.win32.programmer.networks)
  • Re: string change in jsp
    ... Which platform do you use for development? ... in Java program or JSP please use its unicode rather than ... using ASCII or ISO-8859-1 ... but when i am passing this string in querystring its not taking the ...
    (comp.lang.java.programmer)
  • Re: Current Class Path
    ... | Could anyone tell me how to get the class path and not the jdk path? ... * Returns a string consisting of the current working directory. ...
    (comp.lang.java.programmer)
  • Re: Complete command arguments
    ... Is it possible, in a Java program, to get the complete command ... string that was used to start that program? ... Thats really quite easy, a mere "enhanced for loop" does the job quite nicely: ...
    (comp.lang.java.help)