|
yes, m_count is a member of A,
i call every A instances's Fun1(), but not every one can work,
some of them maybe wrong. but this matter is not allways happened.
I use them like this:
CDlg1 has a A instance m_first;
CDlg2 has a A instance m_second;
I add the CDlg1 dlg1, CDlg2 dlg2 in a TabCtrl;
normally the m_first and m_second can work.
but sometime the m_first maybe wrong, and sometime the m_secodn
maybe wrong.
.
|
|
|
|
|
then I'd put the following trace to the Fun1() as well as to the Fun2() . You should see diffenent numbers - you will see exactly what is stored in m_count in different instances. This could help to define the next debugging steps.
<br />
TRACE( "instance 0x%08X called, m_count = %d\r\n", this, m_count );<br />
|
|
|
|
|
One reason the design does not work is because there is no synchronization. Threads and processes must be synchronized.
Kuphryn
|
|
|
|
|
to geo_m:
thank you for your help, i add the TRACE in the Fun2(),then
i find one of the A instance create the thead failed;
When i call AfxBeginThread(), it return 0, so some A do not work.
thank you very much.
.
|
|
|
|
|
to geo_m:
thank you for your help, i add the TRACE in the Fun2(),then
i find one of the A instance create the thead failed;
When i call AfxBeginThread(), it return 0, so some A do not work.
i call it again, it's ok!
but i don't understand why it will fail.
.
|
|
|
|
|
In a DLG based app,I want to draw something on a CONTROL (static) and there are some another CONTROL on the Dialog.
I Get the DC of the Static control and draw something on it,but failed.I see nothing on the static control.So I delete the sentnce
CDialog::OnPaint()
And then,all of these control except the staitc can't be seen.(they are not being paint)
I want to paint the Static control but hope the other control will draw it themself!
How can I do?
Thank you for your help!
Don't look at me in that way!
|
|
|
|
|
from the MSDN under GetDlgItem, changed to be a CStatic, assuming you are using the MFC
// uses GetDlgItem to return a pointer to a user interface control
CStatic* pStatic;
pStatic= (CStatic*) GetDlgItem(IDC_STATIC1);
pStatic->SetWindowText(_T("Hello world"));
<HR SIZE=1 /HR>
<i>If I have seen further it is by standing on the shoulders of Giants.</i> - Isaac Newton 1676
|
|
|
|
|
I just want to draw a picture on it!
exmaple:
I want to draw some lines on the static control!
when I do this ,nothing can be seen in the control.
Don't look at me in that way!
|
|
|
|
|
I am working from memory here.
In that case the best method, I think, would be to subclass the control.
Or you could try get the CDC of the static control, using my #1 method and use this to paint, also add the paint logic into the OnPaint. BUT the control may decide to paint it it's slef therefore overwriting what you have put there! I use this method to place a bitmap into a static control.
If I have seen further it is by standing on the shoulders of Giants. - Isaac Newton 1676
|
|
|
|
|
Thank you! I got it!
Don't look at me in that way!
|
|
|
|
|
My program needs to execute a function when an the internet become available (ie. Dial-up connection established ...) How do I get this event?
Msn messenger automatically logs in when the internet becomes available, but I haven't been able to figure out how it catches the event.
|
|
|
|
|
Use a 30 second Timer to call InternetGetConnectedState.
Jason Henderson My articles
"The best argument against democracy is a five-minute conversation with the average voter." - Winston Churchill
|
|
|
|
|
|
I have made several attempts to retreive data from the registry and it has not worked. I have been using code from http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnppc2k/html/ppc_stry.asp and it hasn't been working for me. Could anyone tell me what is wrong with their code, particularly the LoadPreferences() function they posted. I would really appreciate any help.
-- Steve
|
|
|
|
|
Okay here is a down and dirty way to read a registry setting. This has worked great for me for years.
<br />
HKEY hKey;<br />
char szProductType[80];<br />
DWORD dwBufLen;<br />
int i;<br />
<br />
<br />
RegOpenKeyEx( HKEY_LOCAL_MACHINE,<br />
"SOFTWARE\\SomeRegKey\\SomeSubRegKey",<br />
0, KEY_QUERY_VALUE, &hKey );<br />
RegQueryValueEx( hKey, "SomeRegValue", NULL, NULL,<br />
(LPBYTE) szProductType, &dwBufLen);<br />
<br />
i = atoi(szProductType);<br />
RegCloseKey( hKey );<br />
<br />
return i;<br />
I'm basically reading in a value from the registry that was saved as a character and changing it to an int and returnig that int to the calling function.
Hope this helps
Tom Wright
tawright915@yahoo.com
|
|
|
|
|
That code really helped me. I was trying to store a string and load a string from the registry, but the modifications weren't that hard. Thanks! I can finally use the windows registry in a meaningful way for my applications!
-- Steve
|
|
|
|
|
I've created a dialog based app. After it runs through the oninit section I want it to run another function to load up some list boxes. How do I call this other function? Before everything was alway driven by events being fired from a button being pressed or something being selected. So how do I call a functon without an event?
Thanks
Tom Wright
tawright915@yahoo.com
|
|
|
|
|
Tom,
All you need to do is add a member function to the dialog, e.g.
CMyDialogApp::LoadListBox(CListBox* pListBox)
Once you've got your function built, just call it from the OnInitDialog() function.
You can find a more detailed example here: http://www.codeproject.com/dialog/dialogapptute2.asp[^]
Regards,
Paul Lyons, CCPL Certified Code Project Lurker What a long, strange trip it's been - Robert Hunter
|
|
|
|
|
Your right. The problem I'm having is that I want the main dialog screen to come up. Then I want to call another function that loads up my list box. If I can't load my list box (getting items from a COBOL database) then I want an error returned back. If I add this call to the function, in my OnInit section to, load the list box, my main dialog window does not come up until after my list box is loaded or has errored out.
Hope this makes sense.
Thanks
Tom Wright
tawright915@yahoo.com
|
|
|
|
|
|
Mike
I'm a little confused on how I do this. I've read the MSDN lib and it still is not clear. Can you give some more info?
Thanks
Tom Wright
tawright915@yahoo.com
|
|
|
|
|
I have a need to call a Java servlet running in Solaris from Java and VC++ application. Basically i will be doing a http post to a url and sending a UTF-8 encoded GZip compressed XML document. I will get return as XML document from the servlet. I am able to achieve the required funtionality in Java applicaion as follows.
PrintWriter out = null;
connection = (HttpURLConnection) servlet.openConnection();
connection.setDoOutput(true);
connection.setUseCaches(false);
connection.setDoInput(true);
connection.setRequestMethod("POST");
out =
new java.io.PrintWriter(
new OutputStreamWriter(
new GZIPOutputStream(connection.getOutputStream()),
"UTF8"),
true);
out.println(argString);
out.flush();
out.close();
GZIPInputStream in = new GZIPInputStream(connection.getInputStream());
BufferedReader buff = new BufferedReader(new InputStreamReader(in));
output = buff.readLine();
The same functionality i need to implement it in a VC++ application. During my post in the Java servlet it is giving stream not serialized and also i don't know how to do gzip compression for the post operation. I am using the following code,
IXMLHTTPRequestPtr pIXMLHTTPRequest = NULL;
HRESULT hr;
try {
CoInitialize(NULL);
hr=pIXMLHTTPRequest.CreateInstance("Msxml2.XMLHTTP");
SUCCEEDED(hr) ? 0 : throw hr;
hr=pIXMLHTTPRequest->open("POST", "http://url.Servlet", false);
SUCCEEDED(hr) ? 0 : throw hr;
hr=pIXMLHTTPRequest->setRequestHeader("Content-Type", "text/xml");
SUCCEEDED(hr) ? 0 : throw hr;
hr=pIXMLHTTPRequest->send(bstrString);
SUCCEEDED(hr) ? 0 : throw hr;
bstrString=pIXMLHTTPRequest->responseText;
MessageBox(_bstr_t(bstrString), _T("Results"), MB_OK);
if(bstrString)
{
::SysFreeString(bstrString);
bstrString = NULL;
}
} catch (...) {
MessageBox(_T("Exception occurred"), _T("Error"), MB_OK);
if(bstrString)
::SysFreeString(bstrString);
}
If some one can provide some sample to achive this functionality in VC++ will be helpful.
|
|
|
|
|
See my WebResourceProvider[^] article for examples of how to post an HTTP query (and get its response). Specifically, check out the zip code decoder example.
/ravi
Let's put "civil" back in "civilization"
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
Please help me in improveing my Programing Skills.
nhb
|
|
|
|
|
Work your way through the tutorials here and on MSDN. Oh and get some good books.
If that doesn't help, go on a Training Course.
If that doesn't help, maybe this isn't the career for you.
Anna
Homepage | My life in tears
"Be yourself - not what others think you should be"
- Marcia Graesch
"Anna's just a sexy-looking lesbian tart"
- A friend, trying to wind me up. It didn't work.
Trouble with resource IDs? Try the Resource ID Organiser Visual C++ Add-In
|
|
|
|