|
Yes but in general is rarely the case because this code has been tested by a lot of people before you.
Another reason is that you want to learn how the wheel turns
|
|
|
|
|
Possibly it's no rounder but lighter...
Steve
|
|
|
|
|
Hi
I am creating a dialog based application. I have made a globle thread function (I know it is not a good idea but...). I have a dialog box in which i have an edit box. Now from within that thread, i want to change value of that edit box. Can anyone please help me how can i do that? I tried to get handle to that dialog but i could not...
Thank you.
We Believe in Excellence
www.aqueelmirza.cjb.net
|
|
|
|
|
Hi
If u r using MFC, the AfxBeginthread function have a parameter to send a parameter to thread from calling function.
U can send the dialog's pointer to thread and by the dialog's pointer u can change the edit box value.
syntex:
AfxBeginThread(threadname, stacksize, void_parameter);
For exam,
void CMyDlg::OnBtnClick()
{
AfxBeginThread(MyThread, 0, this);
}
UINT MyThread(void *param)
{
CMyDlg *dlg= (CMyDlg )param;
.........
dlg->m_MyEdit.SetWindowText(text);
.........
return 0;
}
U can refer the sterday's message
http://www.codeproject.com/script/comments/forums.asp?msg=1452858&forumid=1647#xx1452858xx
|
|
|
|
|
Hi Parthiban
you are right but as i think, your code will work fine if CMyDlg is the main dialog of my application. But in my case, the dialog is not main dialog. It added that dialog from resoures. This dialog is a pop up dialog. In my case, that dialog is not initiating the thread. Thread is being initiated by main dialog.
Sorry i forgot to mention it before. Please help me.
Thank you.
We Believe in Excellence
www.aqueelmirza.cjb.net
|
|
|
|
|
Hi
Wat ever be the Dialog. if u can able to get the pointer of the dialog then u can change any values in the dialog.
Aqueel wrote: Thread is being initiated by main dialog.
Can u explain when u r initiating thread from main dialog? is any event from pop-up dialog?
|
|
|
|
|
In fact it is a timer. In main dialog, when user presses a button, a small dialog appears that counts time remaining and displays this time in an edit box.
I used your method. But how will i use UpdateData(false) here because to display changed value i will have to call this function.
Thank you.
We Believe in Excellence
www.aqueelmirza.cjb.net
|
|
|
|
|
GetDlgItem(IDC_THE_EDIT)->SetWindowText("new caption");
|
|
|
|
|
Hello comunity,
i need to look for a Users homepath, i need them when the user dont have an admin rights, and need to save programsettings to a ini-file, so i want to look for hims homepath, wich funktion i need for this???
regards
break;
-- modified at 3:18 Wednesday 19th April, 2006
|
|
|
|
|
Use LPVOID GetEnvironmentStrings(void)
Vision is Always important and so is your ATTITUDE.
Wishes.
Anshuman Dandekar
|
|
|
|
|
|
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dllproc/base/getenvironmentstrings.asp
You can find some more help on this site
Vision is Always important and so is your ATTITUDE.
Wishes.
Anshuman Dandekar
|
|
|
|
|
My MDI application needs the main title of the application in different color
I can not find WM_NCPAINT in MainFrame. So how to go about it.
Leya
|
|
|
|
|
|
I have to programatically simulate toolbar button click for all toolbar buttons present in a window. I cld successfully get the toolbar handle, and controlid of each toolbar button on the window so i use SendMessage with TB_PRESSBUTTON to simulate toolbar button click but button click does not happen and window attached to a toolbar button is not launched?
Currently am using EnumChildWindows() to get handle of the toolbar control attached to the window.
i use SendMessage(hwnd, TB_PRESSBUTTON, ibuttonid, TRUE) with TB_PRESSBUTTON having got the toolbar handle and each toolbar button controlid, to click each toolbar button but button click does not happen and the window attached to the toolbar button does not get launched.
with TB_PRESSBUTTON i see the effect of each button being greyed only but not clicked.
Am i missing something. Pls suggest how do i programatically simulate each toolbar button click to launch the window associated with resp toolbar button?
Waiting for a response.
Thanks.
Sincerely
Giftsana
|
|
|
|
|
Sorry, I was wrong about TB_PRESSBUTTON earlier. I saw the message and thought it was similar to the property sheet/wizard message that actually does simulate a button press.
I don't see anything in MSDN about simulating clicks. If you know the command IDs, you can just send the main window WM_COMMAND messages, which is what the toolbar would do anyway.
--Mike--
Visual C++ MVP
LINKS~! Ericahist | NEW!! PimpFish | CP SearchBar v3.0 | C++ Forum FAQ
|
|
|
|
|
Hello Michael
Thanks for the reply.
I got it working using
SendMessage(hWnd,WM_COMMAND,IDC_QUOTE,MAKELPARAM(GetDlgItem(hWnd,IDC_QUOTE),BN_CLICKED));
Thanks again for the suggestion.
Sincerely
Giftsana
Singapore
|
|
|
|
|
Hi freinds,
Why C++ constructor's does not have address ?
above question may be iterative..the answers I have got from internet/subordintaes are very generic like
1) They are special functions implemented by compiler
2) compiler may optimize constructors based on platform achitecture
3) Constructor call special memory routines so can not be exposed with address
4) constructor address is not needed at all, so why bother?
5)Any function which has return types must have address. and constrctor is not having return type and so the address.
I am not convinced by this generic statments. Experts can u please help me to have some precise/practical answers or with examples?
VikramS
-- modified at 2:56 Wednesday 19th April, 2006
|
|
|
|
|
Hi all,
Can we add two dialogs to the same class?
Consider two dialogs A and B of class clz.
now if i make a call as
clz obj;
obj.DoModal();
here which dialog is invoked.
Thank u.
More Relaxed the person high is his status.
|
|
|
|
|
I am not sure if you can -- I personally would avoid trying.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<br />
Peter Weyzen<br />
Staff Engineer<br />
<A HREF="http://www.soonr.com">SoonR Inc.</A>
|
|
|
|
|
Hello Peter,
I have such an requirement and should invoke dialog A and B as required.please suggest regarding this.
HEllo
|
|
|
|
|
I would recommend something more straightforward -- like creating 2 additional classes -- one for each special dialog you must show. The primary class contains no dialog, but initiates the additionals...
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<br />
Peter Weyzen<br />
Staff Engineer<br />
<A HREF="http://www.soonr.com">SoonR Inc.</A>
|
|
|
|
|
First of all you can't add two dialogs at the same time to a class. If you try doing the same the message to change the dialog is popped up
SO there is no question that you can invoke two dialogs at the same time through the same class variable.
How ever you can create two dialogs from a dialog
These dialogs can be modeless or one whatever you decide.
now use
Create function and pass the id of the dialog to create the dialog
Create(IDD_DIALOG1,this);
Vision is Always important and so is your ATTITUDE.
Wishes.
Anshuman Dandekar
|
|
|
|
|
I just tried we can add two dialogs to the same class.
HEllo
|
|
|
|
|
Can you tell me how you did that because the compiler itself asks you to change the id of the dialog when we try to do the same
Vision is Always important and so is your ATTITUDE.
Wishes.
Anshuman Dandekar
-- modified at 2:35 Wednesday 19th April, 2006
|
|
|
|