|
You say the code used to work and that you haven't changed anything. What about the data that you are putting into the dialog? Have you tried rebuilding all your project, sometimes the debug info can get out of synch with the source code and make you look in the wrong places.
I'd be tempted to move the strTemp and _bstr_t code to the top of the function. See if it crashes on the same line of code or in a different place.
Michael
|
|
|
|
|
It probably has nothing to do with access violation, but why are you using CString::Format? Is the code you've posted a real stuff or a simplified version?
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
it's just a part of my code, as i'm a beginner in ado connection, i have read some articles about it, and i have found this way of proceeding. So, if you want to suggest me another way of doing, feel free to do it.
|
|
|
|
|
- If I just use the function "TlsAlloc" and do not use the function "TlsSetValue", I think we just allocate an index and do not allocate a memory space to store value of variable.
- Am I right?
- Regards,
Maer
|
|
|
|
|
Index == space to store the value of (void *) which will be passed later in the call to TlsSetValue.
What exactly do you want to do with TLS?
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
- Thanks pal!
- Your reply is the one I am looking for. But when I am going to click the "this helped" button to vote for you, I meet a trouble! I can not find the "this helped" button.
- I just want to write an article about different OS with different process/thread implemention method. It is my homework of my class of advanced operating system.
- Have a nice day,
Maer
|
|
|
|
|
Hi All!
I have GUI application. If it running from GUI I output some information using MessageBox. But if it running from command line it must output some information in parent console (cmd.exe) while GUI application working in GUI.
How can I do it ?
Thanks a lot!!!
|
|
|
|
|
|
Yes, it is!
|
|
|
|
|
- The following statements are taken from MSDN:
The WM_DRAWITEM message is sent to the owner window of an owner-drawn button, combo box, list box, or menu when a visual aspect of the button, combo box, list box, or menu has changed.
- But I do not know what means "owner-drawn button".
- Can you show me an example?
- Regards,
Maer
|
|
|
|
|
'owner-drawn' button is a button which has BS_OWNERDRAW style set. With this style on button, Windows will send WM_DRAWITEM message to the parent of button when it needs to be repainter. Parent gets the device context (and other information) in the DRAWITEMSTRUCT and actually paints the button.
Use this owner-draw stuff when you want to change the default look of the buttons. CodeProject has many articles about owner-drawn buttons, but they use MFC, not plain Win32 API.
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
- Thanks pal!
- Your reply clarifies my doubts.
- I still have a question. When you are mentioning "parent", are you referring to parent window?
- Can you help?
- Regards,
Maer
|
|
|
|
|
When you are mentioning "parent", are you referring to parent window?
Yes. This is usually a dialog or property page.
If you're going to implement owner-draw in a MFC app, note that MFC does some magic for you and 'reflects' the WM_DRAWITEM message to the button itself - all you need is to override the CButton::DrawItem.
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
- Thanks pal!
- Your reply is the one I am looking for.
- Regards,
Maer
|
|
|
|
|
- Hi, Sowinski pal!
- I still have a question. Can I implement the message handler function in the parent class and not in the CButton class?
- Can you help?
- Regards,
Maer
|
|
|
|
|
Can I implement the message handler function in the parent class and not in the CButton class?
Yes. Just handle WM_DRAWITEM and do not call the base class (CWnd::OnDrawItem does the reflection and delegates drawing to buttons).
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
- Thanks, Sowinski pal!
- Your reply clarifies my doubts.
- Regards,
Maer
|
|
|
|
|
You might want to take a look at some of the controls at CP, there are a few owner-draw buttons available with source. Creating one which acts almost identically to a standard Win9x button is a peice of cake. Just check the button's state and draw accordingly in DrawItem() .
Simon
Hey, it looks like you're writing a letter!
|
|
|
|
|
- Thanks, Simon pal!
- Your reply clarifies my doubts.
- I still have a question, where can I find the "CP" as you mentioned?
- Can you help?
- Regards,
Maer
|
|
|
|
|
I have a Combobox with an edit control.
It's possible to have items in the list that are more wide than the edit control, but in the edit control the user can't enter more characters in the offschreen area so if the edit control is filled, there is no possibility to enter more characters. Any idea how to solve this?
|
|
|
|
|
|
If you enable the "Auto HScroll" option in the combo box (in the resource editor) the edit box will scroll to the right, like a regular edit box.
Regards,
Alvaro
|
|
|
|
|
Thank you this helps. Sorry for bothering you with this DAU question. My mistake was that I took an extended Combobox which hasn't this option.
So now my app works fine. Thanks a lot!
|
|
|
|
|
Hi...
does anyone have a sample code in which insted of using CFileDialog, u create a customized dialog box wherein u have the standard list showing drive /directories / and etc??? I'm having problems with how to create a list showing the subfolders and existing files similar to when you have CFileDialog...
Thanks a million......
|
|
|
|
|
Hi..
i know that CreateDirectory (..) and RemoveDirectory (..) creates and removes directories respectively.. but how do i ensure that if i create a new directory, the contents within the directory and its subfolders (if it was existing) are deleted...
Thanks a LOT...
|
|
|
|