using MessageBox()

EDN Admin

Well-known member
Joined
Aug 7, 2010
Messages
12,794
Location
In the Machine
I have used MessageBox for error messages etc with out problem
now that my code is more complex its getting to the point where I need to think about it more
I do things like this

<div style="color:Black;background-color:White; <pre>
BSTR strClassProp = SysAllocString(L<span style="color:#A31515; "LoadPercentage");
hRes = pClassObject->Get(strClassProp, 0, &v, 0, 0);
<span style="color:Blue; if (hRes != S_OK) {
MessageBox(NULL, L<span style="color:#A31515; "Could not Get Value", L<span style="color:#A31515; "", MB_OK);
<span style="color:Blue; return;
}

SysFreeString(strClassProp);
_bstr_t bstrPath = &v; <span style="color:Green; //Just to convert BSTR to ANSI
<span style="color:Blue; char* strPath=(<span style="color:Blue; char*)bstrPath;

<span style="color:Blue; if (SUCCEEDED(hRes))
MessageBox(NULL, LPCWSTR(strPath), L<span style="color:#A31515; "", MB_OK);
<span style="color:Blue; else
MessageBox(NULL, L<span style="color:#A31515; "Error in getting object", L<span style="color:#A31515; "", MB_OK);

[/code]
<br/>
<br/>

Now functions simply return, any problem posting WM_QUIT for an about error


<hr class="sig My MVP is for the Windows Desktop Experience, i.e. Windows XP, Vista and Windows 7 IT
Remote Assistance is available for a fee. Visit my IT site for information.
I am best with C++ and I am learning C# using Visual Studio 2010. My page on
http://www.hardcore-games.tk/wp/vc-overheating.html Video Card Problems is now my most popular landing page.
http://www.contract-developer.tk Developer | http://www.windows-it.tk/
Windows IT | http://www.chessmaster.tk Chess | http://www.global-econ.tk
Economics | http://www.hardcore-games.tk/ Hardcore Games | http://www.vegan-advocate.tk
Vegan Advocate | http://www.pc-reviews.tk PC Reviews

View the full article
 
Back
Top