|
Hello Friends,
I am using win32 application. In that I hide the Application on Dialog Initialization and put the icon in the taskbar. I am using the Context menu in taskbar. Ans Want to show the window when someone choose the Exit option of the menu. But it show me the strange Error.
Error code = 0x000005B4 which means "This operation returned because the timeout period expired. "
I am using following code
LRESULT CALLBACK MyDialogProc(...)
{
ShowWindow(hWndDlg,SW_HIDE);
switch(message)
{
case WM_TASKMSG:
if(lParam == WM_RBUTTONDOWN)
{
POINT pt;
GetCursorPos(&pt);
TrackPopupMenuhmenuTrackPopup,NULL,pt.x ,pt.y,0,hWndDlg,NULL);
}
break;
case WM_COMMAND :
switch(LOWORD(wParam))
{
case ID_Exit:
if( ! ShowWindow(hWndDlg,SW_SHOWNORMAL) )
{
dError = GetLastError();
}
}
}
}
I search lot on google for this error but it show that this type of error comes with database(SQL Connection) only.And not getting any solution
Please Help me if u know the solution. Thnx in advance
|
|
|
|
|
GauranG33 wrote: I am using win32 application. In that I hide the Application on Dialog Initialization and put the icon in the taskbar. I am using the Context menu in taskbar. Ans Want to show the window when someone choose the Exit option of the menu. But it show me the strange Error.
Error code = 0x000005B4 which means "This operation returned because the timeout period expired. "
First, don't hide a window in the first line of a dialog proc. It will be called many times for many reasons. Also, I think calling ShowWindow could involve a recursive call to your dialog proc, which immediately hides the window again.
Nathan
|
|
|
|
|
Hi. Thnx for you reply.
Can you please tell, Then Where to put the ShowWindow() Funcion to hide the Window.
Because when I use it at the statring or ending of WM_INITDIALOG it shows me
different errors as follows
WM_INITDIALOG:
{
if( ! ShowWindow(hWndDlg,SW_HIDE) )
dError = GetLastError();
...
...
if( ! ShowWindow(hWndDlg,SW_HIDE) )
dError = GetLastError();
}
|
|
|
|
|
Do you know what ShowWindow() returns? Your code assumes that if it returns a zero value, there must've been an error. That's an incorrect assumption.
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
GauranG33 wrote: Can you please tell, Then Where to put the ShowWindow() Funcion to hide the Window.
I haven't seen your code to create the dialog, but your problem could be that it's a modal dialog, which makes specific assumptions about when the dialog is shown and hidden. If you make a modeless dialog and its template doesn't specify that the window is visible, then the dialog will remain hidden till you want to show it.
|
|
|
|
|
I want to extract properties from .docx/.xlsx file using VC++. Anyone here who can help me out.
|
|
|
|
|
docx and xlsx are actually zip files. rename some into .zip and you'll find your happiness
|
|
|
|
|
To Whom It May Concern,
I have a C++ application which connects to an FTP site (using a third-party FTP software) , uploads a file (a request), waits for the request to be processed (signaled by creation of another file) and proceeds to download that file. So as you can see it's pretty straight forward.
However some of my clients are warning me against using FTP (security reasons) and they are asking if I can develop an application that would use HTTPS instead. I'm not sure how to go about doing this. For starters are there third-party applications that allow me to make an HTTPS connection (taken into account all the different firewalls, etc... settings that my current third-party FTP software handles) and secondly can my application still just upload a file using HTTPS, and download the answer as it currently does? Has anyone here ever rewritten a FTP application to work with HTTPS instead?
I realize that this may seem silly to some of you experts out there but ANY help or guidance you can give me in this matter is greatly appreciated.
Yours,
A.
|
|
|
|
|
al_in_the_city wrote: ANY help or guidance you can give me in this matter is greatly appreciated.
I suggest you read about both FTP and HTTP/HTTPS until you fully understand them. Giving you a short description in a forum response would not satisfy your need to fully understand the protocols. However considering your eagerness to relegate responsibility to third party components you might consider using Google to find some as there are many so that shouldn't be difficult.
|
|
|
|
|
Hi A,
U R concern is to upload a file to a server .
fist question is do u wish to use the mange code or don't want .NET classes in your code ?
If you say u use .NET ur all set very easy task :
Use the WebClient or HttpWebRequest .
If you say u dont want manage code :
The protocol u want to use is HTTPS , so you should use WinInet or WinHTTPS
I have struggled to upload the file with WinHTTPS .
If u get the upload right let me know we can share our experience
Vikas Amin
Fedex
|
|
|
|
|
Hey Try WinHTT API's
Those work great ..............
I just had a successful test
Bless You
Vikas
Vikas Amin
Fedex
modified on Friday, August 1, 2008 11:39 AM
|
|
|
|
|
I have a dumb question. I basically have two issues that are for the same question. I am using Microsoft Visual Studio 2005 C/C++ compiler.
The first issue is that I have a basic C application that will read in a text file, excel file, SQL 2005 database file and import them to Oracle. The code does not use any of the MFC foundation classes or even the C++ classes. It is basic C. The code does use Oracle' pro-C compiler to interact wit the Oracle database but that is not the question.
I compiled my code on Windows XP Professional using static linked libraries. I am not using any Window specific DLLs except what is available for the C compiler. I want to compile my code on Windows XP and run the application .EXE on Windows 2000, Windows 2000 Server, and Windows 2003. I found out that I could do this. I successfully ran my application built for Windows XP on Windows 2000, Windows 2000 Server and Windows 2003 without a problem.
I am basically linking with the PlatformSDK out of MS Visual 2005 Studio. I just want to verify that I will have no problem. I tested it and it appears to be no problem.
The second issue is that I also have a GUI application that uses the Windows SDK for GUIs (no C++ MFC foundations). This application creates a dialog box and adds buttons and menus that allow the user to create schedules for the oracle database via a GUI interface As I mentioned it is an older version of code that is just being maintained. It was also built on Windows XP and runs on Windows 2000 and Windows 2003.
The question:
1. Does anybody know if compiled code (statically linked) built on Windows XP will cause an issue on Windows 2000, Windows 2000 Server and Windows 2003?
2. Do I have to install VC8 Dlls? It appears that I do not since I am using the PlatformSDK and basic C.
Thanks
Dennis Russell
|
|
|
|
|
Statically linked is good but not the same thing as self contained. Every API call you make will still end up in a version dependent Windows Dlls, that shouldn't attempt to update, loaded at runtime from a runtime determined location with the potential for the function to be missing on older versions of Windows. Even the statically linked C Library makes runtime calls to Windows Dlls, some before your code even gets executed when your process starts.
Provided you code defensively to allow for this where you can then you shouldn't have any other problems on the versions you mentioned. Running code accross NT and non NT based (i.e 9x/ME) versions is another kettle of pirhanas.
Nothing is exactly what it seems but everything with seems can be unpicked.
|
|
|
|
|
Thanks Matthew,
I appreciate it.
|
|
|
|
|
I'm getting errors like this
error C2664: 'GetModuleFileNameW' : cannot convert parameter 2 from 'char *' to 'LPWCH'
char szFilespec [_MAX_PATH]; // filespec // Get name of .exe file //sans name
::GetModuleFileName (0, szFilespec, _MAX_PATH);
and
error C2664: 'atoi' : cannot convert parameter 1 from 'ATL::CStringT<basetype,stringtraits>' to 'const char *'
time_t CLogRead::GetTimeFromStrings(char *chDate,char *chTime){
struct tm t;
CString tmpStr;
CString strMonth;
tmpStr = chDate;
tmpStr +=" ";
tmpStr += chTime;
t.tm_year = atoi(tmpStr.Mid(7,4)) - 1900;
i seem to recall this is something about Unicode. How do I change my project tio get rid of these compile errors? I'm not familiar with the IDE so if you could direct me how to,I'd appreciate it.
thanks,
sb
|
|
|
|
|
Open the project properties, go to "C/C++" -> "Preprocessor" and click on the "Preprocessor Definitions" line. A button will appear on the right of this line, click on it this will display a dialog. On this dialog uncheck the "Inherit from parent or project defaults".
|
|
|
|
|
Thanks Cedric,
It wanted _AFXDLL after I unchecked the inherited ones, so I entered it by hand. It seems to have gotten past that point now.
Apppreciate your help,
sb
|
|
|
|
|
ns wrote: char szFilespec [_MAX_PATH];
change this line to using TCHAR instead of char
|
|
|
|
|
Dear All
Hi
We write one program with Visual C++ which connects to sql server DB 2000 for data base operations.
We use windows 2000 OS in our project.
sometimes our program hangs up for a while and after it program exits.
We think that it is because of SQL server interaction.
The logs which we create shows that all critical threads hangs for a while before program exit.
First we think that it is because of one exception in our program, but we setup Dr Watson and don't catch any exception when program exits.
Do you have same experience about SQL server interaction.
Do you have any idea bout testing our proram to find the reason the this error.
If you have any idea about this bug please let me know.
Regards
|
|
|
|
|
Hi All,
I was playing around with char pointers just trying to learn things and noticed that if I malloc the size of a char and set what the returned poitner points at to be 'AB', when I cout what the pointer points to it writes out 'B'.
This is the code:
char *mainBuf = NULL;
mainBuf = (char*)malloc(sizeof(char));
*mainBuf = 'AB';
cout << "mainBuf=" << mainBuf << endl;
The output is:
mainBuf=B
I really didn't know what this would do as like I said I was experimenting. In a way I was surprised it did not crash because I thought cout looked for the terminating null character.
Can anyone help me understand why this does what it does?
Thanks.
|
|
|
|
|
yadrif wrote: mainBuf = (char*)malloc(sizeof(char));
*mainBuf = 'AB';
What exactly are you expecting to do with this? You are passing 1 to malloc() , yet you are trying to stuff, albeit incorrectly, 2 bytes into mainBuf . Why?
Why are you using malloc() with a C++ program. Use new instead:
char *mainBuf = new char[3];
strcpy(mainBuf, "AB");
delete [] mainBuf;
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
DavidCrow wrote: yet you are trying to stuff, albeit incorrectly, 2 bytes into mainBuf
Nope, 'AB' is one byte (it is different than "AB"), this will be truncated to one byte. But I think the compiler should give an error there instead of a warning...
|
|
|
|
|
Point taken, but it's wrong nonetheless.
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Nope, 'AB' is a short int that will truncated to one byte
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|