|
You need to create a DialogBar
Project/Add To Project/Compnents and Controls Gallery/Visual c++ Controls then select Dialog Bar
Reagards..
Carlos Antollini.
Sonork ID 100.10529 cantollini
|
|
|
|
|
I need to bring an app to the foreground when some event has occured.
I've come up with the following code so far:
//in a CDialog
if(this != GetActiveWindow())
{
if(this->IsIconic())
this->ShowWindow(SW_RESTORE);
else
{
this->SetForegroundWindow();
this->SetActiveWindow();
DWORD dwVersion;
dwVersion = GetVersion();
if(dwVersion < 0x80000000 && (DWORD)(LOBYTE(LOWORD(dwVersion))) >= 5)
{
//Win 2000
this->ShowWindow(SW_MINIMIZE);
this->ShowWindow(SW_RESTORE);
}
else
//NT 4.0
this->ShowWindow(SW_SHOW);
}
}
This is not preferrable, imagine the following situation (in Windows 2000):
The window is 100% visible but the focus is set to the desktop. When the event occurs the window is minimized and showed again (with the animation!)
Not minimizing the window results in some flashing in the taskbar.
Any ideas to solve this ?
Thanks in advance
Greetings,
Niko
|
|
|
|
|
How to run the "services" cpl using "ShellExecute" or "CreateProcess" ?
thanx
|
|
|
|
|
Check KB article Q135068. Basically, to launch control panel applets you need to call rundll32.
BTW: on 2K/XP services are no longer in Control Panel - they are launched in Management Console instead.
Tomasz Sowinski -- http://www.shooltz.com ** If you're going to rape, pillage and burn, be sure to do things in that order. **
|
|
|
|
|
Hi,
I want to implement an object that can look up a string in a table and return an integer based on that string. Is there a nice MFC class to do this for me?
jon
Sorry to dissapoint you all with my lack of a witty or poignant signature.
|
|
|
|
|
If you insist on MFC, use CMapStringToPtr. Pointers are just integers.
You may also consider std::map.
Tomasz Sowinski -- http://www.shooltz.com ** If you're going to rape, pillage and burn, be sure to do things in that order. **
|
|
|
|
|
tsk. Tomasz, you just made me use STL for the first time. I lost my STL virginity.
I'm somewhat suspicious of STL though. My (test,experimental) program worked first time. Whats that all about??!?!
FYI, so you can rip it to pieces (and I know you're gonna hate the CString):
std::map<CString,int> l;
map <CString, int> :: const_iterator matching_item;
l.insert( map <CString, int> :: value_type ( CString("bob"), 20 ));
l.insert( map <CString, int> :: value_type ( CString("alf"), 23 ));
l.insert( map <CString, int> :: value_type ( CString("fred"), 19 ));
l.insert( map <CString, int> :: value_type ( CString("steve"), 12 ));
l.insert( map <CString, int> :: value_type ( CString("stu"), 45 ));
l.insert( map <CString, int> :: value_type ( CString("jon"), 2 ));
l.insert( map <CString, int> :: value_type ( CString("jim"), 543 ));
matching_item = l.find ( CString("jon"));
int d = matching_item->second;
thanks for your help!
Sorry to dissapoint you all with my lack of a witty or poignant signature.
|
|
|
|
|
Am i right in thinking that I can use any of my own defined classes in STL? provided I include things like comparison operators, etc etc ??
Sorry to dissapoint you all with my lack of a witty or poignant signature.
|
|
|
|
|
Yes. AFAIR, std::map requires only operator < - it's actually a tree, while MFC maps are hashtables.
Tomasz Sowinski -- http://www.shooltz.com ** If you're going to rape, pillage and burn, be sure to do things in that order. **
|
|
|
|
|
Jon Hulatt wrote:
know you're gonna hate the CString
I'm not going to hate CString. If something works, let it work
Just FYI, STL has the std::string class.
Tomasz Sowinski -- http://www.shooltz.com ** If you're going to rape, pillage and burn, be sure to do things in that order. **
|
|
|
|
|
Tomasz Sowinski wrote:
Just FYI, STL has the std::string class
This much I know. But the app is heavily MFC right now; CFile, CStdioFile, CAsyncSocket, etc etc.
What i'm using the map for is to turn mime-type strings into default file extensions. I'm now using a <CString,CString>> pair for the map, the first is the type (eg. CString("application/x-msword")) and the second is the default file extension (eg. CString("doc")). My source data, which ultimately came from a Socket, is currently in a big char buffer. But I can't see that std::map<LPCSTR,LPSTR> would do what i wanted, because two pointers to "application/x-msword" point to the same data, but probably in different places, so the internal comparisons won't work.
Really, I probably should never have used char buffers. But I understand them, whereas this STL thing is new to me (i've avoided it for as long as possible!!!). So, in the short term for this project, since it's use of MFC already means it runs like a lubricated turd, I might as well just make life easier by creating a CString out of my LPCSTR.
thanks again
Sorry to dissapoint you all with my lack of a witty or poignant signature.
|
|
|
|
|
Jon Hulatt wrote:
I'm somewhat suspicious of STL though. My (test,experimental) program worked first time. Whats that all about??!?!
I think I found my new sig.
I'll just mention that it's easier to insert into a map like this:
l[CString("bob")] = 20;
l[CString("alf")] = 23;
You can also extract like this, but the downside is if the item you try to extract does not exist, it will be created, so you need to do this:
if (l.end() != l.find(Cstring("bob")))
assert(20 == l[CString("bob")]);
You've inspired me, I'll finally pull it together and write my set/map article today.
P.S. when you post STL code or anything else that uses templates, don't forget to turn off HTML in the post, so all the code is posted.
Christian
The tragedy of cyberspace - that so much can travel so far, and yet mean so little.
"I'm thinking of getting married for companionship and so I have someone to cook and clean." - Martin Marvinski, 6/3/2002
|
|
|
|
|
Could anyone give some indication about interpreting the nSide parameter of OnSizing (WM_SIZING) in a MFC application?
It looks like taking random values.
rechi
|
|
|
|
|
Works as advertised on my machine. Are you getting values other than WMSZ_xxx flags?
Tomasz Sowinski -- http://www.shooltz.com ** If you're going to rape, pillage and burn, be sure to do things in that order. **
|
|
|
|
|
I get WMSZ_xxx flags in strange combinations.
For example, i use top-right corner to resize and i get WMSZ_BOTTOMLEFT activated. It doesn't have any sense for me.
rechi
|
|
|
|
|
Strange. I can't reproduce it here. Did you override WM_NCHITTEST?
Tomasz Sowinski -- http://www.shooltz.com ** If you're going to rape, pillage and burn, be sure to do things in that order. **
|
|
|
|
|
I didn't do anything but writing OnSizing for a dialog window.
rechi
|
|
|
|
|
I'm tested this with dialog - and everything works OK. Are you using some 3rd party resizable dialog class?
BTW: you don't have your monitor rotated 180 degrees, do you?
Tomasz Sowinski -- http://www.shooltz.com ** If you're going to rape, pillage and burn, be sure to do things in that order. **
|
|
|
|
|
It's an ordinary resizing dialog.
The combinations are so confusing that it shouldn't work even if i would rotate the TV 180 degrees.
rechi
|
|
|
|
|
What do you mean by 'combinations'? WMSZ_xxx are not bit flags - they're just numbers from 1..8 range. If you're using bitwise operators for testing, you may get strange results.
Tomasz Sowinski -- http://www.shooltz.com ** If you're going to rape, pillage and burn, be sure to do things in that order. **
|
|
|
|
|
Now it's clear; i've been using them as bit flags.
Thanks!
rechi
|
|
|
|
|
beginner
hi im trying to get this code to work, so it would create a table with the alphabet and then allow me to access it using a cipher technique called vigenere. most of the code below is a mess and i cant make sense of it
any help would be appreciated
//fill- create a table 26 by 26 with the alpabet in each row
for (row= 0; row<=25; row++)
{
for (col=0; col=25 =; col++)
{
ch++; ch> 'z'; ch = 'a';
}
}
// access
m_typed = table[row][key]
|
|
|
|
|
I have to change the color if a item on list control, once the user does a double click on it. I have handled the double click and i have the item and subitem details. How can i go abt after this to chage the color of that item
Ganesh M Ramaswamy
|
|
|
|
|
If you want items to have different colors, you'll need to custom-draw the list control. There should be articles about that right here on CodeProject - look in the 'List Control' section.
Tomasz Sowinski -- http://www.shooltz.com ** If you're going to rape, pillage and burn, be sure to do things in that order. **
|
|
|
|
|
Yeah.But the thing is i am not getting a WM_CUSTOMDRAW when double click is made on list control. Am i missing something. Should i get WM_CUSTOMDRAW for double click on item also. thanks for ur time.
|
|
|
|