|
|
I have a dialog box with several controls and I'm creating one control(Combobox) at runtime. I would like to set the focus for this control. Is there a way to change the tab order programmaticaly and set the focus to this control at runtime?
Thanks
|
|
|
|
|
changing the tab order programmaticaly, nop
setting the foccus at runtime, like this :
if using MFC, do this :
pMyControl->SetFocus();
with pMyControl that is a pointer to the control. for example :
CButton* pButton = (CButton*)GetDlgItem(IDC_MY_BUTTON);
understand ?
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
To change the tab order of controls, you have to use the SetWindowPos() function. The hWndInsertAfter parameter is used to set the tab order. Just specify in this parameter the HWND of the window(control) that you want the control you are setting to follow.
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
"Obviously ??? You're definitely a superstar!!!" mYkel - 21 Jun '04
Within you lies the power for good - Use it!
|
|
|
|
|
Hello!
My Problem is, that the Tabbed Rebar is as long as my Main Window. But I want that the tabbed rebar has a with of x=200 and height of y=100. How can I do that manuelle?
here is the link to the example:
http://www.codeproject.com/docking/TabedReBar.asp
thank you in advanced
|
|
|
|
|
I am developing a project using UDP protocol. How i can record sound and play from the server through my client machine. Please do reply asap.
** A Fighter Never Loses !!!!
|
|
|
|
|
there are quite a few example projects here on CP.com, use the search fnuction
modified 12-Sep-18 21:01pm.
|
|
|
|
|
i need tools which can read resource info of exe (or/and dll) files.
if more than one on the internet, please comment the "best" one you think for me.
thx
includeh10
|
|
|
|
|
|
I called FindFirstFile with the search mask "*.m3u" and it finds a file with extension ".mp3~" (i.e. with a tilda at the end)
Is this a bug in FindFirstFile, or am I doing something wrong?
|
|
|
|
|
No I don't think so,Could you show me your coding for that here !!!
-----------------------------
"I Think this Will Help"
-----------------------------
Alok Gupta
visit me at http://www.thisisalok.tk
|
|
|
|
|
WIN32_FIND_DATA findFileData;
HANDLE hSearch;
wxString strMask, strHit, strDiff;
strMask = "F:\\mp3\\Downloaded\\AC DC\\*.mp3";
hSearch = ::FindFirstFile(strMask, &findFileData);
while (hSearch != INVALID_HANDLE_VALUE)
{
strHit = findFileData.cFileName;
}
::FindClose(hSearch);
this will return a hit for any file with extension .mp3~ in said directory
|
|
|
|
|
|
It's the string class from the wxWidgets library
|
|
|
|
|
try to debug the it what exactly extension it has taken
i run this on my pc with CString its working fine
|
|
|
|
|
It doesn't make any difference what string class you use. The bug is in FindFirstFile.
|
|
|
|
|
Please I'd like to know the syntax in using WM_GETTEXT() , for use in retreiving text from an edit box. Where should this syntax be used?
|
|
|
|
|
it you know the ID of the Edit Box use
GetDlgItemText api
-----------------------------
"I Think this Will Help"
-----------------------------
Alok Gupta
visit me at http://www.thisisalok.tk
|
|
|
|
|
Many (actually most) Windows API calls that operate on windows work by sending the target window a message. WM_GETTEXT is the message sent to retrieve a window's text. Both these code fragments will get the edit control's text:
char szText [TEXTLEN];
HWND hWndEdit = window handle of edit control;
::GetWindowText (hWndEdit, szText, TEXTLEN - 1);
char szText [TEXTLEN];
HWND hWndEdit = window handle of edit control;
::SendMessage (hWndEdit, WM_GETTEXT,
(WPARAM) TEXTLEN - 1,
(LPARAM) szText);
/ravi
My new year's resolution: 2048 x 1536
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
|
Hi guys,
i am new to multithreading in MFC. I have gone through many of the examples posted on CodeProject, but i am still not satisfied.
What i want to know is that, suppose i have my window, and i want to create a thread which, say, takes care of all the keyboard inputs, another thread which takes care of all the mouse inputs.
So far whatever examples and tutorials i have gone through first create a new window using a thread and then control all the operations. I want my parent window to have a thread to do all those stuff.
Can anyone help me out.
Thanx in advance!
AslFunky
|
|
|
|
|
With MFC, all GUI interactions must take place on the UI thread; this is inherent to the MFC architecture. You can, however, have separate worker threads that do the actual work associated with keyboard and mouse actions. The UI thread detects a keyboard and/or mouse action and starts a worker thread. The worker thread does its thing, and the posts messages back to the UI thread as necessary.
AslFunky wrote:
i want to create a thread which, say, takes care of all the keyboard inputs, another thread which takes care of all the mouse inputs
This statement sounds like you want to make a general change in how Windows applications work. I think you would be better off learning how to use the Windows input model, rather than trying to subvert it.
Software Zen: delete this;
|
|
|
|
|
Hi thanx for replying,;)
Is it necessary to do my stuff in a worker thread?
Actually i am a little nervous in creating a worker thread. i always have one confusion, how will i assign any job to a function which is not a member of my class. I mean, how will this function
UINT threadproc(void* para)
be able to access the members of my class when it is not a member of my class.
Can you please elaborate on this point.
Thanx in advance.
AslFunky
|
|
|
|
|
AslFunky wrote:
Is it necessary to do my stuff in a worker thread?
That depends on what you need to do. If the process takes a lot of time, you don't want to block the user interface while the process runs. That sort of thing is something you can put in a worker thread.
AslFunky wrote:
I mean, how will this function
UINT threadproc(void* para)
be able to access the members of my class when it is not a member of my class.
I always use something like the following:
class Stuff {
static UINT ThreadStart(LPVOID parameter);
UINT Thread();
};
UINT Stuff::ThreadStart(LPVOID parameter)
{
Stuff *_this = (Stuff *)parameter;
return _this->Thread();
}
UINT Stuff::Thread()
{
}
AfxBeginThread(ThreadStart,(LPVOID)this); The static member function matches the prototype required by AfxBeginThread() . You use the parameter to pass a pointer to an instance of your class. In my example, I passed the this pointer, which means I'm starting the thread from another member function of the class. The function that does the actual work of the thread is called Thread() , and since it is a member function, it can access other members of the Stuff class.
Software Zen: delete this;
|
|
|
|
|
Hi.
The easist way is use
AfxBeginThread (threadproc,hwnd,threadpriority)
threadproc : threadfunction with form
UINT threadproc(void* para)
{
//here do any thing
return true
}
hwnd:this is the para parameter on threadproc function
threadpriority:may be
1-THREAD_PRIORITY_NORMAL
2-THREAD_PRIORITY_LOWEST
.
AfxBeginThread return CWinThread object this object can be use to suspend and kill the thread
u can use many thread with the above story
If this not help u contact me on faroq_tam2004@yahoo.com
to get sample MFC program describe MFC MThreading
bye.
On Earth nothing impossible,
while your mind running.
Faroqtam
|
|
|
|