|
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.
|
|
|
|
|
|
Hello... can you please tell me how to make a program that will draw graphs.. by given data? This is just a simple graph...
|
|
|
|
|
Hi,
If u r looking for 2D graph, check this link NTGraph[^]
Bye,
Cool Ju
Dream Ur Destiny
|
|
|
|
|
Try this
http://www.codeproject.com/docview/graphfx.asp
"A robust program is resistant to errors -- it either works correctly, or it does not work at all; whereas a fault tolerant program must actually recover from errors."
XMinds
|
|
|
|
|
Hello... can you please tell me how to make a program that will draw graphs.. by given data? This is just a simple graph...
|
|
|
|
|