|
"An expert is someone who has made all the mistakes in his or her field" - Niels Bohr
|
|
|
|
|
hi,
i tried to populate a treeview with database calls.. i populate the treeview by populate a node for a record.. each record retrieved from the database call contains an unique id and a description.. i was able to populate the tree with all the description, but i don't know how to store/populate the unique id in the treeview, which is associated to the description.. the unique id and description need to be popuated together in a node.. any help is appreciated.. thank you!
|
|
|
|
|
Use CTreeCtrl::SetItemData()
Cheers
Carlos Antollini.
Pi Five[^]Creator
Sonork ID 100.10529 cantollini
|
|
|
|
|
can you point me to a link with an example on how it's done?
i created a new class, which contains a new datastructure and i tried to append the new datastructure using setitmedata, but didn't work..
this is what i done:
hItem = trCtrl.InsertItem( "some string", 0, 2 );
trCtrl.SetItemData(hItem, (DWORD)myID);
i get error C2440: 'type cast' : cannot convert from 'nodeData' to 'DWORD'
|
|
|
|
|
What kind of data is MyID?
by other side you must to ckeck if hItem has a valid value (hItem != NULL)
Regards
Carlos Antollini.
Pi Five[^]Creator
Sonork ID 100.10529 cantollini
|
|
|
|
|
I create a class for storing the id data..
this is how i define MyID Class in short:
the variable Id is a private int variable. I create a new class for the unique id because if i want to store more data, i can just modify the class.
Class nodeData {
nodeData::nodeData() {
Id = 0;
}
nodeData::nodeData(int x) {
Id = x;
}
}
|
|
|
|
|
One of the third party dlls I used keeps showing a useless modal dialog box. I want to close the dialog box by "clicking" the Yes button from my program. How do I do that?
I was able to get the windows handles of the dialog box and the Yes button. I tried posting WM_LBUTTONDOWN, WM_LBUTTONUP, WM_LBUTTONDBLCLK messages with no success. While the messages were posted, I saw the Yes button being "clicked" (depressed) over and over again, but the dialog box just stayed open. If I post the WM_CLOSE message, then the dialog box can be closed but my program won't work because what I need is "clicking" the Yes button.
Any suggestion or tip is appreciated. Thanks.
P.S. BTW, I was posting messages to the dialog box from a separate thread.
|
|
|
|
|
This works for me:
SendMessage(wndParent,WM_COMMAND,MAKEWORD(::GetDlgCtrlID(wndButton),BN_CLICKED),(LPARAM)wndButton);
regards
modified 12-Sep-18 21:01pm.
|
|
|
|
|
Gregor S. wrote:
This works for me:
SendMessage(wndParent,WM_COMMAND,MAKEWORD(::GetDlgCtrlID(wndButton),BN_CLICKED),(LPARAM)wndButton);
Thanks.
I tried it. The dialog box is still open after the above code is executed. But if I click anywhere on the screen outside the dialog, the dialog will be closed. Actually, this is what happened when I post the WM_LBUTTONDOWN and WM_LBUTTONUP messages: I have to click somewhere outside the dialog to make it close.
Any other suggestion?
|
|
|
|
|
Mhhh, you might try to simulate the mouseclick outside the dialog with
SendMessage(wndParent, WM_ACTIVATE, MAMKEWORD(WA_INACTIVE, 0), LPARAM(HWND_DESKTOP));
But I have not testet it, but actually it should would
regards
modified 12-Sep-18 21:01pm.
|
|
|
|
|
Thanks for your help. The problem was solved with a ::EndDialog call. See my other post for details.
|
|
|
|
|
Why don't you sent it WM_CLOSE ?
What is the useless dialog ? If it's a 'This person has not bought this component, for evaluation only' type deal, you'd expect it to be coded to be hard to close apart from via the button, for example it could check if the mouse is over the button when it is pressed.
Christian
No offense, but I don't really want to encourage the creation of another VB developer. - Larry Antram 22 Oct 2002
Hey, at least Logo had, at it's inception, a mechanical turtle. VB has always lacked even that... - Shog9 04-09-2002
During last 10 years, with invention of VB and similar programming environments, every ill-educated moron became able to develop software. - Alex E. - 12-Sept-2002
|
|
|
|
|
Christian Graus wrote:
Why don't you sent it WM_CLOSE ?
What is the useless dialog ? If it's a 'This person has not bought this component, for evaluation only' type deal, you'd expect it to be coded to be hard to close apart from via the button, for example it could check if the mouse is over the button when it is pressed.
No, I wasn't trying to steal a software. The dll shows the dialog box and ask the user to click Yes or No, however in my case the answer is always Yes and my program is not interactive.
|
|
|
|
|
You _might_ be able to do this:
EndDialog( hWndYourDialog, IDYES );
I haven't tried it, so I don't know if it will work or not.
Chris Richardson
|
|
|
|
|
"I haven't tried it, so I don't know if it will work or not."
I tried, it closed the Dialog, but is not the same as clicking the Yes button, as a result my program would not work afterwards.
Thanks for the suggestion.
|
|
|
|
|
What about sending IDOK instead of IDYES?
|
|
|
|
|
Alexinuk wrote:
What about sending IDOK instead of IDYES?
Great suggestion. But IDOK doesn't do it either, it has to be 4774 (the id of the Yes button). Thanks.
|
|
|
|
|
Chris Richardson wrote:
// Inside your thread. Make sure NOT to mess with any MFC stuff here.EndDialog( hWndYourDialog, IDYES );
I tried it again, this time it worked! Thank you very much!!!
P.S. I used 4774 instead of IDYES, it is the id of the Yes button on the dialog.
EndDialog(hWndDialog, 4774);
|
|
|
|
|
I'm a beginner and I already know how to use dc.MoveTo() and dc.LineTo(), but how can I draw a dotted line instead of solid? Do I need to create a brush, and how would I do it?
The line should look like this (vertical, 3 pixel width, X = black pixel):
x x
x
x x
x
x x
thanks for help!
|
|
|
|
|
You can create pens that are dashed or dotted with these pen styles:
PS_DASH Creates a dashed pen. Valid only when the pen width is 1 or less, in device units.
PS_DOT Creates a dotted pen. Valid only when the pen width is 1 or less, in device units.
PS_DASHDOT Creates a pen with alternating dashes and dots. Valid only when the pen width is 1 or less, in device units.
PS_DASHDOTDOT Creates a pen with alternating dashes and double dots. Valid only when the pen width is 1 or less, in device units.
Brushes can be created with a number of styles ( and a lot more in GDI+ ) that may suit you better.
Christian
No offense, but I don't really want to encourage the creation of another VB developer. - Larry Antram 22 Oct 2002
Hey, at least Logo had, at it's inception, a mechanical turtle. VB has always lacked even that... - Shog9 04-09-2002
During last 10 years, with invention of VB and similar programming environments, every ill-educated moron became able to develop software. - Alex E. - 12-Sept-2002
|
|
|
|
|
A pen with PS_DOT doesn't make a fine dotted line, I tried this.
could you give me an example who to make and use a brush, please?
|
|
|
|
|
Is there any special trick to send a hex value through a serial port?
Thanks, p. t.
|
|
|
|
|
I have an MDI application and need a Combo box that is located as a Toolbar item . This is analogous to the "find in files " Combo Box in the Visual C++ IDE .
Please help
|
|
|
|
|
Please look in MSDN, CodeProject, google, ... ton of people did this already ...
Max.
|
|
|
|
|
what's the difference between a callback function and a function pointer? can anyone show me a short code snippet?
For example, here's a typedef and function pointer:
typedef void (*PostProcessFunc) (int&, ubt&);
void ProcessFunc(PostProcessFunc, int&, int&);
and is CALLBACK a keyword...?
For example:
HDDEDATA CALLBACK DdeCallback(uType, uFmt, hconv, hsz1,
hsz2, hdata, dwData1, dwData2)
I cant find CALLBACK statement/keyword from MSDN....
norm
|
|
|
|