|
I have a service (running under an user account) which needs to access several mapped network drives. It actually worked w/o problems in the past, but now it can't access them anymore. I've read that a service should not access such drives under XP, but that's not really "helpful".
So my question is, is there a solution for this? And was there an update for XP that might have broken things?
Thanks in advance.
|
|
|
|
|
Hi,
I try to rename a file using MoveFile() API function and I want to generate an error message if the function fails, I use FormatMessage() along with GetLastError() to format an error message, but after testing the code, when I attemp to rename to an invalid filename that includes invalid characters like (? / *) I get the error message: 'there is not enough disk space on the disk' and it doesnt seem to be informative... here is the code:
<br />
int iRes=MoveFile(m_strCurrentPath + strFilename,m_strCurrentPath +strNewFilename);<br />
if(iRes!=0)
{<br />
m_lstFiles.GetListCtrl().SetItem(iItem,0,LVIF_TEXT,strNewFilename,0,0,0,0);<br />
return TRUE;<br />
}<br />
else<br />
{<br />
LPVOID strError;<br />
if(FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER|FORMAT_MESSAGE_FROM_SYSTEM ,0,GetLastError(),0,(LPTSTR)&strError,0,0)!=0)<br />
{<br />
MessageBox((LPCTSTR)strError,0,MB_ICONERROR);<br />
LocalFree((HLOCAL)strError);<br />
}<br />
else<br />
{<br />
MessageBox(_T("An Unknown Error has occured!"),0,MB_ICONERROR);<br />
}<br />
}<br />
return FALSE;
And ever has it been that love knows not its own depth until the hour of separation
|
|
|
|
|
Mohammad A Gdeisat wrote: if(FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER|FORMAT_MESSAGE_FROM_SYSTEM ,0,GetLastError(),0,(LPTSTR)&strError,0,0)!=0)
What happens if you change the fourth argument?
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
hi david,
The fourth arg is the language ID, which is not supported in windows mobile platform..
Regards
And ever has it been that love knows not its own depth until the hour of separation
|
|
|
|
|
Mohammad A Gdeisat wrote: ...windows mobile platform.
I must've overlooked that in your original post.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
I want to write a c++ program to convert a j2me source folder to a jar file.
How should i do?is jar file is same as a zip file?
Thanks for any answer!
|
|
|
|
|
cqwangdonghua wrote: I want to write a c++ program to convert a j2me source folder to a jar file. How should i do?
jar is not only a file format but also a tool that produces jar files: http://java.sun.com/j2se/1.3/docs/tooldocs/win32/jar.html[^]
cqwangdonghua wrote: is jar file is same as a zip file?
Basically, yes.
|
|
|
|
|
Thanks!
I know the jar is a tool to create jar format file.But I don't want use it.Since jar file is same as zip format file,so I can zip a src folder and change the filename to create a jar file.But when use I winzip and winrar to do this work today,it do not work. Is jar file not same as zip?what's wrong with it?
|
|
|
|
|
It should work.
A classic mistake, when it doesn't, is that the jar file was FTP using TEXT/ASCII mode instead of binary.
Do you think that's a possibility here?
Alcohol. The cause of, and the solution to, all of life's problems - Homer Simpson
|
|
|
|
|
cqwangdonghua wrote: Since jar file is same as zip format file,so I can zip a src folder and change the filename to create a jar file
No, JAR is a compression format, which is indeed similar in that Zip is a compression format; JAR uses a different algorithm for compressing the files. You will either need to implement the JAR compression algorithm in your application or locate a library to do so.
Check Suns website, as memory serves they have a lib you can use from C++. I believe the original respondent to your question provided you a link to Suns website.
Good luck
I'd love to help, but unfortunatley I have prior commitments monitoring the length of my grass. :Andrew Bleakley:
|
|
|
|
|
Anyone can explain this puzzling and confusing code:
<br />
void recur(void){<br />
static ntimes=0;<br />
<br />
ntimes=ntimes+1;<br />
if(ntimes < 100) |<br />
recur(); | suppose since ntimes=1, output should be leave empty.. Right?:confused:<br />
printf("%d\n", ntimes); | <br />
ntimes--;<br />
<br />
<br />
}
ouput: 100
99
98
.
~~~@@@###EZRA###@@@~~~
|
|
|
|
|
Simple: recursion!
There is only one ntimes-variable (that's what staic means), and it is initialised only once when encountered the first time.
As long as it is below 100, recur() is calling itself, incrementing the variable.
When it reaches 100, a text is printed and all the pending recur()-function come to decrement ntimes.
"We trained hard, but it seemed that every time we were beginning to form up into teams we would be reorganised. I was to learn later in life that we tend to meet any new situation by reorganising: and a wonderful method it can be for creating the illusion of progress, while producing confusion, inefficiency and demoralisation."
-- Caius Petronius, Roman Consul, 66 A.D.
|
|
|
|
|
Thanks now i understand.. ^_^
~~~@@@###EZRA###@@@~~~
|
|
|
|
|
what don't you understand exactly ? the use of the static keyword, and how it works, of the principle of recursion ?
|
|
|
|
|
It is doing the same thing as the following:
int recur(int count)
{
if (100 <= count)
{
return count;
}
else
{
int c = count++;
printf("%d\n", recur(count));
return c;
}
}
If you decide to become a software engineer, you are signing up to have a 1/2" piece of silicon tell you exactly how stupid you really are for 8 hours a day, 5 days a week
Zac
|
|
|
|
|
Alright, I have my GUI written in C and the other document is in command-line and written in C++. I'd like to the command-line code into my GUI on a click of a certain menu item(ID_CONVERT_DEAD) and I do not know how to do so.
LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{<br />
switch(msg)<br />
{<br />
case WM_CREATE:
{<br />
HMENU hMenu, hSubMenu;<br />
HICON hIcon, hIconSm;<br />
<br />
hMenu = CreateMenu();<br />
<br />
hSubMenu = CreatePopupMenu();<br />
AppendMenu(hSubMenu, MF_STRING, ID_FILE_EXIT, "E&xit");<br />
AppendMenu(hMenu, MF_STRING | MF_POPUP, (UINT)hSubMenu, "&File");<br />
<br />
<br />
hSubMenu = CreatePopupMenu();<br />
AppendMenu(hSubMenu, MF_STRING, ID_CONVERT_MM, "&MessengerMate");<br />
AppendMenu(hSubMenu, MF_STRING, ID_CONVERT_MIDDLE, "&Middle_Man(Coming Soon..)");<br />
AppendMenu(hMenu, MF_STRING | MF_POPUP, (UINT)hSubMenu, "&Convert to..");<br />
<br />
SetMenu(hwnd, hMenu);<br />
<br />
<br />
hIcon= LoadImage(NULL, "RidV.ico", IMAGE_ICON, 32, 32, LR_LOADFROMFILE);<br />
if(hIcon)<br />
SendMessage(hwnd, WM_SETICON, ICON_BIG, (LPARAM)hIcon);<br />
else<br />
MessageBox(hwnd, "Could not load large icon!", "Error", MB_OK | MB_ICONERROR);<br />
<br />
hIconSm= LoadImage(NULL, "RidV16.ico", IMAGE_ICON, 16, 16, LR_LOADFROMFILE);<br />
if(hIconSm)<br />
SendMessage(hwnd, WM_SETICON, ICON_SMALL, (LPARAM)hIconSm);<br />
else<br />
MessageBox(hwnd, "Could not load small icon!", "Error", MB_OK | MB_ICONERROR);<br />
}<br />
break;<br />
case WM_COMMAND:<br />
switch(LOWORD(wParam))<br />
{<br />
break;<br />
<br />
case ID_FILE_EXIT:
PostMessage(hwnd, WM_CLOSE, 0, 0);<br />
break;<br />
case ID_CONVERT_MM:<br />
<br />
break;<br />
case ID_CONVERT_MIDDLE:<br />
<br />
break;<br />
}<br />
<br />
break;<br />
case WM_CLOSE:
DestroyWindow(hwnd);<br />
break;<br />
case WM_DESTROY:
PostQuitMessage(0);<br />
break;<br />
default:<br />
return DefWindowProc(hwnd, msg, wParam, lParam);<br />
}<br />
return 0;<br />
}
All this info is just to give you an idea of what I want to do since I'm not too sure what the technical term for the procedure is. Also, whenever I move the installer out of the directory that the icons are in, it'll produce the errors and i'm wondering how to fix it to where no matter where the installer is, it shows the icons. I've already tried googling and searching through every C/C++ site out there on how about to do this but as I didn't know exactly what I was looking for I wasted hours so I decided to come to this message board for help.
Any help is greatly appreciated.
|
|
|
|
|
how's supposed to be called the command-line exe ?
can't you just use ::ShellExecute() ?
|
|
|
|
|
Alright, I'll try and make it clearer as I know my post probably didn't make much sense.
I don't want the command-line.exe, I want to incorporate the code that's in the command-line program into my GUI. I have the source files for the command-line program and would like to be able to put the source for the command-line into my GUI and be able to run the source I put from the command-line from a menu item(ID_CONVERT_DEAD). I just need to incorporate it into my GUI and Window app.
Does this clear it up a bit?
|
|
|
|
|
if you have the source, then what's the problem ?
can't you copy/paste the code you need in your new project ?
|
|
|
|
|
Can I show you the codes to everything?
Also, if I add all those I still don't know how to execute the certain commands on the menu item.
|
|
|
|
|
Hi, all.
I am encoutering some communication problem while using synchronous SOCKET.
I have a client which sends data to server with Gbps network in the speed of about 200kB/s. I invoke select function to judge whether I can send data everytime.If it fails I will re-create a socket to connect the server. But when I count the packets sent in client and received in server, I find they are not the same. why this happens? how to impove it?
|
|
|
|
|
What network protocol do u use?
Mohammad
And ever has it been that love knows not its own depth until the hour of separation
|
|
|
|
|
|
From my little experience with winsock, I suggest that you do not re-create a socket everytime select fails (if 'fails' means that you cant write to the socket at the moment), but if 'fails' means that the connection fails, you should recreate a socket on the client AND put the socket on the server in listen mode.
I imagine that ur problem goes in the following scenario:
Client: Connect ,Server:OK
Client: Send ,Server: recv
Client: Send (fails) ,Server recv() no data
Client: Re-connect , Server (Still waiting for data) - not ready to welcome incoming connection
Regards,
Mohammad
And ever has it been that love knows not its own depth until the hour of separation
|
|
|
|
|
I added a cbutton to a cstatusbar. the button comes with thick borders around it when viewed in xp style. how to remove the borders?(I have set noborders style to the status bar pane)
|
|
|
|
|