|
The handle is the handle of the COleControl derived class, but, since you are in "this" control, take the :: off.... so the call would be:
SendMessage(LB_ADDSTRING, 0, (LPARAM) _T("Testing"));
Note that call has to be made after the control has been created... for example, after the call to COleControl::OnCreate call and on..
Jaime
|
|
|
|
|
Yes that works!.
But now I have a little problem and I dont know why. I want to handle the message OnDrawItem() and OnMeasureItem() and the program flow never pass through these functions. Do you know what is the problem?.
Thank you very much.
Roger.
PS: Sorry about my english.
Demian.
|
|
|
|
|
Yes that works!.
But now I have a little problem and I dont know why. I want to handle the message OnDrawItem() and OnMeasureItem() and the program flow never pass through these functions. Do you know what is the problem?.
Thank you very much.
Roger.
PS: Sorry about my english.
|
|
|
|
|
Have you modified the style to LBS_OWNERDRAWFIXED or LBS_OWNERDRAWVARIABLE before control creation?
You may also think about painting the control in WM_PAINT message.
Jaime
|
|
|
|
|
Hi Everybody,
We are looking for C++ Programmers in India. Its a contract work for one year. Programmers can work from home.
Please contact Sandeep Gandhi @ Sandeep@landmark4u.com
Thanks
|
|
|
|
|
Does anyone here know how I would go about detecting dependencies for an application and/or DLL. I need to be able to do this in my own source code because I am writing an application that requires this information. Since I can not redistribute dependcy walker or dumpbin ( as far as I know ) i need to do this on my own. If any knows a) how to do this or b) where a good resource about this is I would greatly appreciate it.
Joseph Dempsey
joseph_r_dempsey@yahoo.com
|
|
|
|
|
For implicitly loaded DLLs, check out the .idata section of the file. For explicitly loaded DLLs (i.e., LoadLibrary() ), I do not know of a way.
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
|
I have some modeless dialog, where WebBrowser is downloading
some pages.
I need to do this in background, it means, this window won't be
activated unless user click into the dialog, or will select it in task manager.
How to do this ? Sometimes IE after downloading web page will set this dialog as active
Thank you !
rrrado
|
|
|
|
|
i did not test it, but i would start this way.
after
m_Modelessdialog->ShowWindow(SW_SHOW);
i would use
this->SetActiveWindow();
or
this->SetFocus();
or
this->BringWindowToTop();
etc.
to get the focus pack to the parent.
just try
hope it helps
George
|
|
|
|
|
hi,
i want to create only one connection to my db in my app.
im trying to do myConn.Open() in the InitInstance() function in my App but it throws me an exception. what should i do?!
|
|
|
|
|
Avi Laviad wrote:
...but it throws me an exception. what should i do?!
How about telling us what the exception is, or maybe what the code looks like? It's hard to provide anything useful with the little bit of information you've provided.
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
well, here is full detail of my code: (i hope)
in my CXXXApp::InitInstance() i did:
<br />
m_pConnection.CreateInstance(__uuidof(Connection));
try<br />
{<br />
m_pConnection->Open<br />
("Provider=Microsoft.Jet.OLEDB.4.0;"<br />
"Data Source=D:\\DATA\\Nwind.mdb", "", "", -1);<br />
<br />
}<br />
catch(_com_error *e)<br />
{<br />
CString Error = e->ErrorMessage();<br />
AfxMessageBox(e->ErrorMessage());<br />
}<br />
catch(...)<br />
{<br />
<br />
}<br />
when i do this code in my View (it's MDI app) everything works fine.
when i do this - im getting into the catch(...).
is it making any sense to ya?
Avi.
|
|
|
|
|
Avi Laviad wrote:
when i do this - im getting into the catch(...).
What message is displayed?
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
no message, i don't have anything in the "catch(...)".
how can i know the message?
(sorry for my , i guess, stupied questions, im a newbie)..
Avi.
|
|
|
|
|
My bad. I saw the one catch statement but not the other. I know of no way to ascertain the type/cause of exception at that point.
The last database application I did, the database object belonged to the document (as opposed to the app or the view). The document had methods for opening and closing the database connection.
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
Are you sure you called CoIninitialize(NULL) before CreateInstance call?
If you didn't call, you need to add that call before the CreateInstance and CoUninitialize() in ExitInstance function.
Jaime
|
|
|
|
|
well thanks you very very much jaime!!!
thank you all for your patient..
Avi
|
|
|
|
|
Some additional comments.
1.- Be sure CoInitialize is only called once in your application, and CoUninitialize is called just before shutting down the application.
2.- There was an easy way you could use to know which error occured. You know that CreateInstance returns an HRESULT. If after the call the pointer was 0x00000000, you can know the error by mean of the HRESULT (0 means no error).
For example, write the line this way:
HRESULT hr = ....CreateInstance(...);
or
TRACE("%x", ....CreateInstance(...));
Then copy the resulting code to the clipboard and finally, run the Error Lookup utility (present in Microsoft Visual Studio Tools menu). The copied error code will appear in Value edit box. Press Look Up button and the corresponding message will appear in Error Message window. For example, for your particular error, hr is 0x800401F0... using Error Lookup, you will get the message "CoInitialize has not been called".
Alternatively you can search that HRESULT code in winerror.h file.
Cheers
Jaime
|
|
|
|
|
wow!!
it's one of the help that i need to make as a Favourite Page.
10x man!
Avi.
|
|
|
|
|
Put a breakpoint on m_pConnection->Open line. Check to see if m_pConnection is not NULL and is valid.
If it isn't a _com_error it is more likely the pointer m_pConnection is invalid.
Ant.
I'm hard, yet soft. I'm coloured, yet clear. I'm fuity and sweet. I'm jelly, what am I? Muse on it further, I shall return! - David Williams (Little Britain)
|
|
|
|
|
i did it before and the pointer m_pConnection was NULL (0x00000000).
i do it in the InitInstance of the MainApp.
but if i do it in the View, everything is OK.
...
|
|
|
|
|
hi,
whats the name of the function that returns me the global application pointer?
|
|
|
|
|
If you are using MFC,
AfxGetApp() .
I Dream of Absolute Zero
|
|
|
|
|
I have 2 tree controls and when i drag an item form one tree control to another, the tree control doesnot get refreshed.
what should i do to avoid that
Manickavasagam N
Software Engg. Consultant
ISRO Satellite Centre
Bangalore
|
|
|
|