|
You need to draw the image in your OnPaint handler, then it will be drawn whenever your form needs to refresh itself.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Also check that you are deleting all your GDI objects correctly. If your app runs out of them it can cause unusual display problems.
A good way to check for GDI leaks is watching the GDI object count in the Task Manager, finding them is another problem altogether.
|
|
|
|
|
maybe it is some helpful to you
CImage m_Image;
m_Image.Load(Filename);
In funtion Onpaint(WM_PAINT)
OnPaint()
{
CPaint DC(this)
m_Image.BitBlt(dc.m_hDC,CRect(0,0,800,600),CPoint(0,0));
// m_Image.StretchBlt(GetDC()->m_hDC,CRect(0,0,200,200)/*Dest*/,CRect(0,0,800,600));
}
|
|
|
|
|
Hi!
I am trying to run an .exe file in my C++ code.
Let me say,
I have do.exe program.
And another control_do.exe program that can run do.exe conditionally.
Any code suggestion that is generic, not VC++?
I am using Visual Studio 2005, but code is standard c++, but VC++.
Thanks!
Yonggoo
|
|
|
|
|
|
|
Use shell Execute
for example this line below opens a browser connecting to the appropriate link passed to it where xyz is the name of the site
ShellExecute(NULL, NULL,"http://xyz.com", NULL, NULL,SW_NORMAL );
Vision is Always important and so is your ATTITUDE.
Wishes.
Anshuman Dandekar
|
|
|
|
|
|
Hi,
I've having problem when trying to open a database connection using CDatabase::OpenEx method.
Windows return the error message: Error 997. Overlapped IP Operation in progress.
dbp->OpenEx(Connectionstr, CDatabase::noOdbcDialog);
Where Connectionstr value == "DSN=myDSN" and myDSN is a defined system DSN on the system.
Note. This application have two CDatabase object pointing to two differnt mdb file. The first object open sucessfully using the same OpenEx method.
Please help.
Thanks
|
|
|
|
|
How do I do this:
typedef enum Something {
FirstValue,
SecondValue,
ThirdValue,
FourthValue,
Etc
} Something;
int main( void )
{
Something MyVar;
MyVar = SecondValue;
MyVar++;
}
Regards [[]]
hint_54
|
|
|
|
|
One possible solution is casting via numeric type such as integer.
Kuphryn
|
|
|
|
|
Try
MyVar = (Something)(MyVar + 1);
This is dangerous behavior since MyVar+1 may not be in Something such as:
<br />
typedef enum Something {<br />
FirstValue=0,<br />
SecondValue=2,<br />
ThirdValue=4,<br />
FourthValue=6,<br />
Etc<br />
} Something;<br />
|
|
|
|
|
Yes, I know I can do that, but I want operator ++.
Regards
hint_54
|
|
|
|
|
You will have to overload operater ++ for your problem.
We Believe in Excellence
www.aqueelmirza.cjb.net
|
|
|
|
|
You mean global scope, right? I was trying to avoid it.. But if I must
regards
hint_54
|
|
|
|
|
Should not do this.
If you must do this, you can replace "TYPEDEF" by "CLASS".
Then, overloading operator ++.
|
|
|
|
|
you mean:
class enum tSomething {
blablabla
};
?? Can I do that??
hint_54
|
|
|
|
|
I have a VC++ application where I need to read (and sometimes parse) the contents of various printer manufacturers INF files to populate a listbox to enable our users to select which printer to install. I am stuggling to find example code using the following setupapi calls
SetupGetLineByIndex
SetupGetStringField
I have tried using the Profile api's also, but some INF's are better than others and using GetPrivateProfileSection doesn't always work successfully and involves rather messing string handling.
Any help would be appreciated, many thanks in advance.
|
|
|
|
|
I'm not sure if this is the right forum for this question, but I apologize if this question should be asked in a different place?
I would like to create a application (windows MFC for now) that uses a custom tag that will exist in web pages and email applications (e.g. Outlook emails). Basically, the new tag will have URL in the format of mytag://www.somesite.com . When the user clicks on the link with the custom tag the application is triggered.
Also, I would like the handcursor to be different to show a custom icon when the mouse is above the custom link. Is this possible? How can I implement this or where can I find more information on how to implment this application?
any information will be greatly appreciated!
|
|
|
|
|
|
thanks, another question comes to mind:
If I want to create a windows program that modifies the default HTTP hyperlink behavior is this still possible?
For example, whenever the mouse cursor is over a specific HTTP link to a site (e.g. www.flowers.com), a system tray message pops up. If the HTTP link is over any other site, no message appears. The HTTP link can be in either browser, word, or outlook. Also, if the user clicks on the specific link I would want to run the custom application before the actual page is opened. What's the easiest way to do this in windows?
thanks again!
|
|
|
|
|
Hi there,
The following example ist intended to transfer the data of a structure SKupParam from a uC to the PC. How can I reset the pointer *pKupParam to its orginal value after I have received the data, if this has to be in another method? Or how can I declare the pointer global?
<br />
LONG CKupDlg::OnCommunication(WPARAM ch, LPARAM port) {
static unsigned char *pKupParam = (unsigned char *) &gKupParam; <br />
*pKupParam++ = ch;<br />
return 0;<br />
}<br />
<br />
|
|
|
|
|
I'm having a bit of an issue with sending data through HTTPS via wininet in a C++ test app:
I can download any page through HTTP with:
InternetOpen( ..., dwFlags )
InternetOpenUrl( ..., "http://...", ..., dwFlags, 0 )
InternetReadFile( ... )
I can download a secured page through HTTPS with the same code with the following changes:
InternetOpen( ..., dwFlags | INTERNET_FLAG_SECURE )
InternetOpenUrl( ..., "https://...", ..., dwFlags | INTERNET_FLAG_SECURE, 0 )
InternetReadFile( ... )
At that point my buffer contains the plain/decrypted text, while a packet sniffer only shows encrypted data, telling me that indeed the encryption/decryption happens transparently as far as my program knows.
I can upload a binary file through HTTP with:
(read file content in some buffer, lpvBuffer)
InternetOpen( ..., dwFlags )
dwPort = INTERNET_DEFAULT_HTTP_PORT
InternetConnect( ..., lpszServer, dwPort, NULL, NULL, INTERNET_SERVICE_HTTP, dwFlags, ... )
HttpOpenRequest( ..., "POST", lpszPage, ..., dwFlags, 0 )
HttpSendRequest( ...,
NULL, // no custom header
0, // so its size isn't needed
lpvBuffer, // content of my file
dwSizeOfBuffer ) // size of my file/buffer
lpvBuffer is the content of my binary file, and dwSizeOfBuffer is its size. I've confirmed that the server correctly receives the file at the other end, and saves it back into a binary file--windiff says they're identical. Great. Everything so far works.
Now...my ultimate goal...after all these successful tests...is to upload a binary file through HTTPS...
I thought it would be a simple matter of setting the INTERNET_FLAG_SECURE flags again, setting dwPort to INTERNET_DEFAULT_HTTPS_PORT, and going through the same code as shown above (the last snippet)--but it doesn't work. My client appears to send the data and then sits on HttpSendRequest(), waiting for it to return, and eventually times out (ERROR_INTERNET_TIMEOUT).
I suspect that the size of the data being actually transmitted over the wire doesn't match the size I specify (dwSizeOfBuffer--the size of my file), since it's now being sent through HTTPS (and not plain HTTP), so--? this is speculation on my part ?--the server is waiting for more data to be sent than I specify in dwSizeOfBuffer, while the client's actually done, so it's also waiting on the server...eventually the client times out.
My initial assumption was that as far as my program is concerned, I shouldn't even have to worry about specifying the size of the *encrypted* buffer, and I should only have to specify the size of my actual file (the fact that it's now going through HTTPS should be transparent to the layer I'm working at). If that's the case...then I don't understand why HttpSendRequest() returns only after timing out...
It doesn't make sense to me that I'd have to even *know* the size of the encrypted data that would follow the HTTP header. I don't even have any idea what that size is, so I can't accurately set dwSizeOfBuffer myself (HttpSendRequest()'s last parameter). The API lets you specify -1 for the size of the custom header buffer (parameters 2 and 3), and it'll figure out the actual size by looking for a terminating NULL, but this won't work here because my stream (lpvBuffer) is a binary file and NULLs (ASCII-0) can appear anywhere. Besides, the documentation doesn't imply that the API can figure out the size of lpvBuffer on its own, which makes sense because whatever follows the HTTP header could be anything, not just NULL-terminated strings...
On the server side...I have a simple .ASP page that saves whatever's returned in Request.ReadBinary() into a file. As mentioned, that works fine for plain HTTP.
Any thoughts?
|
|
|
|
|
You should have a custom header. eg
Content-Length: <plain-data length="">
HttpSendRequest will not generate the content-length for you.
|
|
|
|
|
> You should have a custom header. eg Content-Length:
>
> HttpSendRequest will not generate the content-length for you.
Are you sure about this? I'm not setting a content-length header, and in HTTP mode, my packet sniffer (Ethereal) shows that a Content-Length header has indeed been generated, with the length I specified in HttpSendRequest()'s dwOptionalLength parameter. The file gets there and a binary comparison shows that it's identical to the one I sent.
I just need to do the same with HTTPS. I'm not sure why the header would be required in this case but not the former. Regardless, I tried to do it explicitely with HttpAddRequestHeaders(), and got the exact same results...
-- modified at 8:44 Thursday 23rd March, 2006
|
|
|
|
|