|
Hi,
How do i make my dlg window have focus..
I mean i have a small system tray icon.. when i press it
it displays a window.. how to i set focus on that
|
|
|
|
|
With SetForegroundWindow ?
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Along with Joaquín's answer, the CWnd::ShowWindow will also do the trick. I personally prefer this function as it has more options with regards to how to handle minimize, maximize, hiding, etc.
Cheers,
Tom Archer
Author, Inside C#
Please note that the opinions expressed in this correspondence do not necessarily reflect the views of the author.
|
|
|
|
|
I need to create an application which loads parts of its GUI (views) and functionality(docs) depending on the connected device type at runtime.
My first idea was to create several extension DLLs providing the neccessary functionality and load them at runtime. But this seems to be rather complicated since extension DLLs normally are
statically linked via the DLLs lib (aren't they ?). How can i overcome this ?
Any ideas ?
|
|
|
|
|
Use dynamic linking on your Dlls!! see MSDN.
Sorry to dissapoint you all with my lack of a witty or poignant signature.
|
|
|
|
|
Dynamic linking, sure ... but tell me how , GetProcAddress works only for plain functions, not classes or objects
|
|
|
|
|
Make a signature in every dll. I.e. a minimun set of exported functions. In your case, assuming you are using MDI, it might look like
CMultiDocTemplate* __cdecl GetDLLDocTemplate()
{
CMultiDocTemplate* pDocTemplate;
pDocTemplate = new CMultiDocTemplate(
IDR_CHARTDLLTYPE,
RUNTIME_CLASS(CDLLDoc),
RUNTIME_CLASS(CDLLFrameWnd),
RUNTIME_CLASS(CDLLView));
return pDocTemplate;
} I guess this will work no mather what type of DLL you are using, since it doesn't export any classes.
|
|
|
|
|
Use your imagination a little, have the function you export return a class/struct.
|
|
|
|
|
My artical on this subject shows how it can be done:
http://www.codeproject.com/docview/docviewfromdll.asp
Roger Allen
Sonork 100.10016
yet to be identified being from the planet Paltinmoriumbanfrettybooter
|
|
|
|
|
Just read the article - nicely done, Roger. No idea why you got a 4 out of 5 when the article does exactly what the title says and explains every step
Cheers,
Tom Archer
Author, Inside C#
Please note that the opinions expressed in this correspondence do not necessarily reflect the views of the author.
|
|
|
|
|
Actually I show how to do this in my Visual C++.NET Bible. If you're still having problems, email me and I'll send you a demo and that part of the chapter.
Cheers,
Tom Archer
Author, Inside C#
Please note that the opinions expressed in this correspondence do not necessarily reflect the views of the author.
|
|
|
|
|
I am using the code below to display my
dialog boxx..
The problem is that whenever it is displayed.. it
is cropped .. and this continues..
CRect myRect;
GetClientRect(&myRect);
ClientToScreen(myRect);
MoveWindow(myRect.left, myRect.top,
myRect.Width(), myRect.Height());
ShowWindow(SW_SHOWNORMAL);
Please Help
|
|
|
|
|
ummmmm
am i missing something or is this a really twisted way of showing a dialog box? is there a running thread of these posts that gets you to here so it makes sense?
situations to avoid #37: "good morning ... how many sugars do you take in your coffee ... and what was your name again?"
coming soon: situations to avoid #38: "...and the dog was there too?"
|
|
|
|
|
I'm with Lauren. I'm not sure what you're attempting to do here since you're not providing much in the way of details. Is this code from an init function (such as OnInitDialog) of the dialog or is this from another class trying to show the dialog?
If it's the former, your dialog is always going to be cropped because you're specifying the client area's height and width for the dialog size. If you just want to move the dialog - and not resize it use the SetWindowPos function and specify the SWP_NOSIZE flag:
SetWindowPos(NULL, 50, 50, 0, 0, SWP_NOSIZE);
Cheers,
Tom Archer
Author, Inside C#
Please note that the opinions expressed in this correspondence do not necessarily reflect the views of the author.
|
|
|
|
|
Hi,
I want that whenever my application starts, the Dialog
(in a dialog based application).. is hidden ShowWindow(SW_HIDE). (Actually this doesn't work under InitDialog()..
How do i do it
Sameer
|
|
|
|
|
This is answered in Mike Dunn's C++ FAQ.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Thanx a lot
|
|
|
|
|
string val = "32742937.234234";
how to change this type of string to double? Thanks!
|
|
|
|
|
Check your documentation on sscanf .
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
strtod()
---
CPUA 0x5041
Sonork 100.11743 Chicken Little
It may be that your sole purpose in life is simply to serve as a warning to others.
|
|
|
|
|
double ConvertStringToDouble(const CString s)
{
char pszString[MAX_PATH];
char* pszStop;
memset(pszString, '\0', MAX_PATH);
strncpy(pszString, (LPCTSTR)s, s.GetLength());
double d = strtod((const char*)pszString, &pszStop, 0);
return d;
}
|
|
|
|
|
double ConvertStringToDouble (LPCTSTR psz)
{
LPTSTR pszStop;
errno = 0;
return _tcstod (psz, &pszStop);
}
or (if you don't like the "T" variables)
double ConvertStringToDouble (const char *psz)
{
char *pszStop;
errno = 0;
return strtod (psz, &pszStop);
}
Since CString has a type cast to LPCTSTR and since you won't be storing the value into another CString, then there isn't any need to use CString in the argument list.
Tim Smith
I know what you're thinking punk, you're thinking did he spell check this document? Well, to tell you the truth I kinda forgot myself in all this excitement. But being this here's CodeProject, the most powerful forums in the world and would blow your head clean off, you've got to ask yourself one question, Do I feel lucky? Well do ya punk?
|
|
|
|
|
Hi,
Suppose while running, my explorer restarts
itself (normally does in Win95 & win98).. how
do i detect that and make my icon in the system
tray REAPPEAR..
Please help
|
|
|
|
|
Assuming you've put the icon in the first place with Shell_NotifyIcon , you can have your app periodically (say with a timer) test whether the icon is still there by calling Shell_NotifyIcon with flag NIM_MODIFY and appropriate hWnd and uID parameters (it's not necessary you actually modify anything). If Shell_NotifyIcon fails, you can assume the icon is no longer present and proceed to insert it again.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
When explorer restarts it broadcasts a registered message "TaskbarCreated". You can process this message to redisplay your icon.
Regards
Phil
|
|
|
|