|
So just don't call CDialogBar::OnInitDialog in CYourDlgBar::OnInitDialog
However, if all you need is edit subclassing, just provide your own Create. Catching WM_INITDIALOG doesn't make sense if all you need is this single operation.
Tomasz Sowinski -- http://www.shooltz.com
*** Si fractum non sit, noli id reficere. ***
|
|
|
|
|
I wonder what you usually do when you want a dialog bar in your application? How do you create the class when you are done with the dialog template?
|
|
|
|
|
lucy wrote:
How do you create the class when you are done with the dialog template?
I'd just create the class without IDE help. Or - I'd select 'generic CWnd' and replace CWnd with CDialogBar later in .h and .cpp.
Tomasz Sowinski -- http://www.shooltz.com
*** Si fractum non sit, noli id reficere. ***
|
|
|
|
|
|
I have a large data strucutre that is used in an embedded C application. I have replicated the strucutre in VC++ and put a class wrapper around it. This data structure contains mostly basic data types. However there are a few fields that are fixed length arrays (char []) as string placeholders.
I need to transport this structure to VBA. I have used IDL in order to solve this before. But I was wondering if you guys have any other reccommendations. ?
We are using an excel spread sheet as a tag list for our product. I will use this data to generate a binary file that will be used by our embedded software to configure hardware at run-time.
Any suggestions would be appreciated, until then Im using IDL.
Ryan Baillargeon
|
|
|
|
|
I know that we ususally put standard MFC includes, but what other things ?
.h files that are never really touched ? .h files that are really global ? even if it offers interface to classes from files that don't need it ( or want it ) ?
Problem is that when I need to add a .h in the stdafx.h it recompiles everything! no a good thing ! ( will recompile the precompile header )
I usually try to limit the stuff that I put in the stdafx.h, and limit the includes in the .h files of my projects, and use a much as possible forward declaration, and put the includes in the .cpp files.
any thoughts, suggestions, ideas ?
Thanks.
Max.
|
|
|
|
|
You'll need to find some compromise. While you could put lots of stuff into precompiled header, this could slow down the build process. Of course, there's no point at all in including stuff you'll *never* use, but if you have large header with templates used by 1 of 300 source files in the project... then probably you should measure build times.
Tomasz Sowinski -- http://www.shooltz.com
*** Si fractum non sit, noli id reficere. ***
|
|
|
|
|
All headers needed by all .cpp files go both to the stdafx and the file. This way, I can both improve code reuse and compiling speed.
"In an organization, each person rises to the level of his own incompetence." Peter's Principle
|
|
|
|
|
In the stdafx.h I usually put,
My own set of library include files
include files that will need to be used across multiple source files
Header files that don't change very often.
Michael
"I've died for a living in the movies and tv.
But the hardest thing I'll ever do is watch my leading ladies,
Kiss some other guy while I'm bandaging my knee."
-- The Unknown Stuntman
|
|
|
|
|
In java, I can do something like this:
Object o=GetSomeObject();
if(o instanceof MyObject)
...
else
... where MyObject is an Object-derived class.
What's the c++ equivalent for this?
using: [VISUAL STUDIO 6.0] [WIN98/2]
|
|
|
|
|
If your compiler has RTTI, you can use dynamic_cast, typeid and type_info.
VC does, if you have RTTI enabled.
"In an organization, each person rises to the level of his own incompetence." Peter's Principle
|
|
|
|
|
Is there an API function to query the available com ports on the system.
Thanks
|
|
|
|
|
I don't think so. I usually check the registry like so:
set<CString> Ports;
HKEY hSerialComm=0;
RegOpenKeyEx(HKEY_LOCAL_MACHINE,"HARDWARE\\DEVICEMAP\\SERIALCOMM",0,KEY_READ,&hSerialComm)==ERROR_SUCCESS||(hSerialComm=0);
DWORD nValues,nLongestName,nLargestValue;
if (hSerialComm && ::RegQueryInfoKey(hSerialComm,0,0,0,0,0,0,&nValues,&nLongestName,&nLargestValue,0,0)==ERROR_SUCCESS && nValues && nLongestName && nLargestValue)
{
CString _Name,_Value;
char* Name=_Name.GetBuffer(nLongestName+1);
char* Value=_Value.GetBuffer(nLargestValue+1);
DWORD NameLen,ValueLen,Type;
for (int i=0;nValues;++i)
{
NameLen=nLongestName+1;
ValueLen=nLargestValue+1;
LONG Result=::RegEnumValue(hSerialComm,i,Name,&NameLen,0,&Type,(BYTE*)Value,&ValueLen);
if (Result==ERROR_NO_MORE_ITEMS)
break;
else if (Result!=ERROR_SUCCESS)
{
break;
}
else
{
--nValues;
if (Ports.find(Value)==Ports.end())
Ports.insert(Value);
}
}
_Name.ReleaseBuffer(0);
_Value.ReleaseBuffer(0);
}
if (hSerialComm)
RegCloseKey(hSerialComm);
Additionally, I will simply just try to open the first few
ports by typical name. (e.g. COM1 ... COM8)
|
|
|
|
|
Hi, all...
==========
Can anyone write a function that returns a list of explorer HWNDs ??
for example:
I have 4 winodows running ....
1- "my computer" (HWND= 0x00AA)
2- "c:\folder1\folder2\" (HWND= 0x00BB)
3- app1 (HWND= 0x00CC)
4- app2 (HWND= 0x00DD)
How can I scan all the HWNDs and identify
explorer windows (HWNDs: 0x00AA & 0x00BB in the example)???
Thanks in advance
|
|
|
|
|
You can enumerate all toplevel windows with EnumWindows and check window class with a call to GetClassName for each HWND you get. You'd have to check Explorer windows class name in Spy++. I'm not sure this name remains unchanged between Win9x/NT/2K/XP.
Your other option is searching for process started by explorer.exe, getting its PID and checking the PID for each HWND with GetWindowThreadProcessId. The problem with this approach is that there's no single process enumeration API working across all 32 bit Windows platforms.
Tomasz Sowinski -- http://www.shooltz.com
*** Si fractum non sit, noli id reficere. ***
|
|
|
|
|
This is the code I used in one of my apps:
EnumWindows(IEEnumProc, 0);
and the enum proc:
BOOL CALLBACK IEEnumProc(HWND hWnd, LPARAM lParam)
{
char szClass[256];
GetClassName(hWnd,szClass,256);
if(strcmp(szClass,"IEFrame") == 0)
{
}
return TRUE;
}
regards
Greg
modified 12-Sep-18 21:01pm.
|
|
|
|
|
But he's after Windows Explorer, not IE. Class name is 'CabinetWClass', at least on my XP box.
Tomasz Sowinski -- http://www.shooltz.com
*** Si fractum non sit, noli id reficere. ***
|
|
|
|
|
yes, you're right. It must be CabinetWClass instead of IEFrame .
I thought he wants to find IE windows, not explorer windows
modified 12-Sep-18 21:01pm.
|
|
|
|
|
Gregor S. wrote:
I thought he wants to find IE windows, not explorer windows
Confess, you are fixed on IE
...if you're under 8 or younger. Chris Maunder, the Lounge
|
|
|
|
|
I'm using Mozilla
modified 12-Sep-18 21:01pm.
|
|
|
|
|
Explorer also uses 'ExploreWClass' as a class name when it displays the folder tree by default.
people are not very wise / don't know their limitations /
don't know what death means / when they play their dirty games 'Killing Fields' Funker Vogt
|
|
|
|
|
|
i am writing an adventure in vc++6. the problem is, ive include a .ini file, with the possible words that a user could enter. when the user enters a command in the game (at the prompt) the program "scans" this file to see if any words match. the problem lies with the [ ] 's in the .ini file
e.g
[nouns]
1 chair
2 school
etc
so i have used the continue statement to "skip" the headings ([nouns] and so on) the prolem with this is when a user types in a "known" command, the program outputs "Do not recognise command" (its set to do this if the words input arent in the .ini file)
any ideas?
Sas
|
|
|
|
|
Post your code; you have a bug. Just show us the loop that processes comands. remember to wrap the code in <PRE> ... </PRE> tags please.
Signature space for rent. Apply by email to....
|
|
|
|
|
I recomand using
http://www.codeproject.com/cpp/ciniex.asp
or http://www.codeproject.com/cpp/ciniex.asp for ini file acess.
But ur method should work, probably a bug!
Papa
while (TRUE)
Papa.WillLove ( Bebe ) ;
|
|
|
|