|
I've just checked, VS 2003 will add the DDX line for you. I don't think it's a dodgy installation you have there, I think it's more likely you unchecked the "Control variable" check box in the "Add member variable wizard".
Try it again to check, making sure that check box is checked, and see if the DDX line is there.
- Dy
|
|
|
|
|
I had indeed unchecked the Control checkbox(because the sample program said so), so I tried what you have suggested, but then instead of generating DDX_Text, DDX_Control got generated and it could not recognize the CString variable. So there was a compilation error Is it something to do with CString not being recognized or something? But then, I did try with other datatypes (char and int), but even then it does not work. I am really at a loss!
ARK
|
|
|
|
|
A 'default' DoDataExchange looks like this:
void CMyDlg::DoDataExchange(CDataExchange* pDX)<br />
{<br />
CDialog::DoDataExchange(pDX);<br />
}
If you deleted the AFX_DATA_MAP lines, then the ClassWizard does not know where to
write the 'DDX' source code. Add those lines back in, obviously changing the name to that of your dialog class, and it should work fine.
People that start writing code immediately are programmers (or hackers), people that ask questions first are Software Engineers - Graham Shanks
|
|
|
|
|
Two things that puzzle me..if that is how the default DoDataExchange looks, how come mine doesn't look like that? I don't have those AFX_DATA_MAP lines. And after I included them (I tried both including them before creating a variable for the control and after the 1st build where the DDX_Text did not get generated), I still have the same problem. I tried out a few other steps too (of changing the datatype of the variable), which I have detailed in my reply to Dy's posting. Pl help me with this. Thanks
|
|
|
|
|
http://www.thecodechannel.com/boards/topic.asp?TOPIC_ID=13[^]
I found the answer for this problem in this link (happens I was following the same book by Tom Archer). Dy, you are right, it is to do with checking the control checkbox; additionally I needed to change the Category from Control to Value. Thanks.
|
|
|
|
|
Hey guys,
My question may seem very simple to most of you, but for me it aint'so easy. I am trying to make a simple application which will create some controls, such as simple buttons, on left mouse button click; and then destroy all the controls if the right mouse button is clicked, but leaving the main window alone.
In reality, I want everything to happen in my main window, without any dialog windows, pop-up windows with controls, or menus - none of that. I was actually trying to make a quiz-like application which will have 5 different screens (for 5 different questions), with five different "stage set-up scenarios" (different questions will have different screens with different controls, sometimes push buttons, sometimes radio buttons, or something else ...). So is there a way to destroy and re-create these buttons on the main window, or is it the case that once you create them, they can't be destroyed so you have to destroy the main window in order to destroy controls in it too?
Any ideas??? Thanks a lot, y'all!
|
|
|
|
|
I just forgot to say that this is win32API, not MFC.
|
|
|
|
|
DestroyWindow(hWnd);
Owner drawn
Jesus Loves
|
|
|
|
|
DestroyWindow(HWND) destroys it only if I put it in the same block of code, for example if I create it in WM_LBUTTONCLICK block of code, I can destroy it in the same block, but if I try to destroy it in WM_RBUTTONCLICK, this will not work. Why is that? And just to make things clear, I am trying to destroy button that I created in the main window. I dont want to destroy main window, it should stay the same, only the button will be destroyed. Any thoughts on how to do this?
|
|
|
|
|
If you want to destroy the button you have to get the handle of the button and then pass this handle to DestroyWindow to get it destroyed.
Owner drawn
Jesus Loves
|
|
|
|
|
Owner drawn wrote: If you want to destroy the button you have to get the handle of the button and then pass this handle to DestroyWindow to get it destroyed.
Yes, and that is what I do. My button's handle is hBtn1 which I use with DestroyWindow function as DestroyWindow(hBtn1), but nothing happens. Once created, button just sits in its place and I cannot destroy it untill I destroy the main window where it sits.
If I am not making this clear, maybe some code will explain. So here is how I create that button:
case WM_LBUTTONDOWN:
{
hBtn1 = CreateWindow("BUTTON","Picture 1", WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON,50,320,70,20,hWindow,(HMENU) 2, hInstGlobal, NULL);
......}
case WM_RBUTTONDOWN:
{
DestroyWindow(hBtn1);
......... }
And that is what I want. On left mouse click I want to create this button in the main window, and on right mouse click I want to get rid of it for good, don't need it any more!
Any ideas why this would not work? Why can't I just call DestroyWindow(hBtn1) and destroy this button?
Thanks! By the way, thanks for working on it Owner Drawn!
-- modified at 23:13 Tuesday 7th February, 2006
|
|
|
|
|
nedimbakic wrote: case WM_RBUTTONDOWN:
{
DestroyWindow(hBtn1);
......... }
WM_RBUTTONDOWN:
{
ShowWindow(hBtn1, SW_HIDE);
DestroyWindow(hBtn1);
}
Owner drawn
Jesus Loves
|
|
|
|
|
That does not work either. I did try to hide it but the damn button just wont go away. It seems as if the button does not recieve messages or something. I have no idea what might be the problem.
-- modified at 7:40 Wednesday 8th February, 2006
|
|
|
|
|
I was able too save the DIALOG DOC output box in a dir. I then saved that file into a RCT file and from that RCT file was able too insert it into powerpoint using the clipboard. Now I can't save without getting OKB instead of 11.8KB.
|
|
|
|
|
Hi!!
I have an mfc sdi application. I have a dialog in which , i had put a text box. I want to open some file(text file), entered by user( in another EDIT CONTROL).
I want that the Edit Control(for displaying file) to remain invisible, until the user clicks on SHOW FILE BUTTON.
Which function should, I use for opening it?? How to do this at button_click??
"If you change then change for the good."
|
|
|
|
|
I think you could:
Open the dialog editor, and in it, set the Visible property of the Second edit to FALSE . Then on button-click, Open the file using:
CFile file;<br />
file.Open("filename.txt",CFile::modeRead | CFile::modeNoTruncate);<br />
int length = file.GetLength();<br />
char* p = new char[length+1];<br />
memset(p,0,length+1);<br />
file.Read(p,length);<br />
file.Close();<br />
m_Edit2.SetWindowText(p);<br />
delete[] p;<br />
m_Edit2.ShowWindow(SW_SHOW);
etc.
this is this.
|
|
|
|
|
|
Well, you are probably right, which is why I wrote ...etc as I meant to give the user an idea. I would be surprised to see code like this used as-is.
this is this.
|
|
|
|
|
khan++ wrote: I would be surprised to see code like this used as-is.
don't ! there are so many beginners asking here that they probably think one could give them a full working code...
TOXCCT >>> GEII power [toxcct][VisualCalc 2.20][VCalc 3.0 soon...]
|
|
|
|
|
I am trying to obtain the SID of the user currently logged in. I obtain the user name using GetUserName, and then the SID using LookupAccountName. This works, however the documentation of LookupAccountName says I must pass the "domain_name\user_name" for the lpAccountName parameter. Does anyone know how to obtain the domain_name of the domain the user is currently logged in?
thanks!
|
|
|
|
|
You can try reading the USERDOMAIN environment variable...
People that start writing code immediately are programmers (or hackers), people that ask questions first are Software Engineers - Graham Shanks
|
|
|
|
|
Hi!
Could anybody suggest me some good books, or free tutorials about MACROS IN vc++.
tHANX
"If you change then change for the good."
|
|
|
|
|
Try here[^]. Boost is full of goodies, simply reading the Boost documentation makes you a better programmer and gives you ideas.
Steve
|
|
|
|
|
I am tryin out a control array with edit boxs, but i encounter the following when i click on class wizard : "Parsing Error: "Expected";" ,Input line CEDIT m_id[17]; "
Can someone tell me what went wrong here ?
|
|
|
|
|
I think you are not allowed to use an array etc inside the ClassWizard's area. I would suggest putting it outside of the ClassWizard's block like:
...<br />
CEdit m_id[17];
this is this.
|
|
|
|