|
I think a handle is changing with every creation of a window, thus your handle once retrieved by Spy won't be valid when the corresponding window has been closed and recreated. Beside that, a call to SetWindowText works also for EditBoxes and doesn't require any item id.
|
|
|
|
|
There are two ways I know to get handle of another window
1-EnumWindows() with a callback function. Then using EnumChildWindows() to search for the target child edit box.
2-WindowFromPoint() to get the handle of the window under the mouse cursor. ChildWindowFromPoint() to get the handle of controls
The EnumWindows() enumerate all top-level windows and pass their handle to the callback function so you can decide whether it's the needed window or not.
The MSDN would provide good information about them
EnumWindows()
EnumChildWindows()
WindowFromPoint()
ChildWindowFromPoint()
|
|
|
|
|
I want to save a BOOL to the registry. SInce I dont know how thats done or even if it can be done, I thought I'd save it as an int, either 0 or 1. SO when I retrieve it from the registry in an int vraible, how do translate it back into a BOOL? My clumsy guess is:
if (varFromRegistry == 1)myBOOL = TRUE; but is it legal to say:
BOOL myBool = (BOOL)varFromRegistry;
Of course if we can directly write a BOOL and read it out as such from the registry that would be better but how to do that?
Appreciate your help,
ns
|
|
|
|
|
Technically, there is nothing wrong with ether approach, but first one is somewhat cleaner, style wise.
|
|
|
|
|
Well, the MS defined type BOOL is an int. You can treat it in every way as an int.
If you can, it is probably better to use the c++-type bool .
bool can be converted like this:
BOOL B;<br />
bool b;<br />
b = (B != FALSE);<br />
B = b;
But if you can not help it, your BOOL can be written and read like an int.
My opinions may have changed, but not the fact that I am right.
|
|
|
|
|
Hi,
I have a very strange and frustrating SDI problem.
I have created a SDI project dealing with image display. When i create a new dialog resources and try to use the class wizard (to assign variables to the controls) , a "Out of memory.Unable to complete command" error msg would occur. Worse still after this time occur, my workspace files seems to be corrupted and i am unable to open my workspace !!! and i would have to redo everything !!
I am currently using VC 6. Anyone can tell me what happen and how can i solve this problem ??
Thank you for your kind attention !!
bk
|
|
|
|
|
I'm pretty sure this has been asked before but have no idea what topic to search on. In the VC6 IDE, when you are editing a file and put your mouse over a variable, the definition of that variable is displayed in "baloon help".
e.g. for my case I had a var declared: char m_Count[70]. So putting cursor over m_Count displays the above.
However, when I redefined the variable to be 80 elements big, the baloon help still says 70 even though I did a complete rebuild. There's probably a file, I have to delete and regenerate but besides the .clw, I'm not sure I could recover gracefully if I deleted the wrong file.
|
|
|
|
|
|
That worked great !! Thanks
|
|
|
|
|
Can anybody please tell me what message is sent from a toolbar control to the main window when a button is clicked on a toolbar?
Thanks in advance,
Paddy
|
|
|
|
|
WM_COMMAND, exactly as from the menu.
|
|
|
|
|
Thanks for the help,
So if I have a button on my toolbar IDT_BUTTON1, I can put in a
<br />
Case IDT_BUTTON1:<br />
in my main WndProc and it should work?
Paddy
|
|
|
|
|
I want to confirm this, but with using breakpoints:
BOOL ret = pImageDisplay->Create(IDD_IMAGEDISPLAY, this);
pImageDisplay->m_zoomFactor = 300;
first the code stepped into Create(), then it went into OnInitDialog, and then came back out to the zoomFactor assignment. So if I had pImageDisplay->m_zoomFactor = 100; in OnInitDialog, and then above, after CReate() I change it to: pImageDisplay->m_zoomFactor = 300; , then I do ShowWindow, its the 300 that should take effect since it overrides the 100 from OnInitDialog. Is this correct? I try to check this out by stepping etc, but the results are inconclusive....
Appreciate your help,
ns
|
|
|
|
|
The value would probably be shown as 100 as OnInitDialog() will call the DDX_... functions. This will use the value of m_zoomFactor which is current (100) before the change in the line after. You could always set it before the call to create. Of course this all depends on how m_zoomFactor is used.
Roger Allen
Sonork 100.10016
Were you different as a kid? Did you ever say "Ooohhh, shiny red" even once? - Paul Watson 11-February-2003
|
|
|
|
|
So the location of the assignment does matter! I guess if its before the Create(), it gets overridden by whats in OnInitDialog.....that fact too I wasnt able to determine conclusively but I'l test again. Makes sense that the order should matter...
Appreciate your help,
ns
|
|
|
|
|
i want to use new help file (old is *.hlp), before start, i need basic idea about it:
1. must create html first (old is rtf)
2. no control id features (old has, id links to specified page).
3. what is its extension (old is hlp)? it needs more time to develop than old ones?
any more comments are useful.
thx.
includeh10
|
|
|
|
|
includeh10 wrote:
want to use new help file (old is *.hlp), before start, i need basic idea about it:
1. must create html first (old is rtf)
Yes. You could create a selection of html pages, and their pics (gif, jpg, etc) using your
favourite html editor. You could even use work (but shouldn't; it's horribly inefficient).
2. no control id features (old has, id links to specified page).
You refer to the original html file (and any #anchors) in the help file.
3. what is its extension (old is hlp)? it needs more time to develop than old ones?
.chm (Compiled Html M????). It can be quicker than the old, as their are lots of tools around
for developing websites which are useful here.
any more comments are useful.
You should look at in the htmlhelp directory on your vc++ 6 cd. I don't know about .NET. I know
the software used to be downloadable from microsoft. I assume it still is. It comes with help
files which should answer most of your question. MSDN library also has the htmlhelp documentation
in it.
Iain.
|
|
|
|
|
With new help you probabably mean HTMLHelp.
includeh10 wrote:
1. must create html first (old is rtf)
Yes, but there should be some tools to convert it.
includeh10 wrote:
2. no control id features (old has, id links to specified page).
HTMLHelp of course sopports context help. See this[^].
includeh10 wrote:
3. what is its extension (old is hlp)? it needs more time to develop than old ones?
chm
Pavel
Sonork 100.15206
|
|
|
|
|
Is there any SDK function or so on - to
logoff Windows user. But I don't mean ExitWindow(
to logoff current user, but if more users is logged.
(you can see (must be Administrator) them in task list CTRL+ALT+DEL
and do login off there)
Like: I will enum users loged on and I need some
chance to chose some from this list and logged him off.
Thank you
Viliam
|
|
|
|
|
How can we create magic packet and brodcast it to a network(I am familiar with Magic packet.., i need the method to create and broadcast)I need it for making Wake On Lan;)
|
|
|
|
|
is there any way to get the facename from a TTF file ?
Thanx
|
|
|
|
|
CString ReadLongName(const char *pszFile)
{
CString csOutName;
static char lpszLongName[256];
unsigned i;
char namebuf[255];
FILE* fp;
unsigned short numNames;
long curseek;
unsigned cTables;
sfnt_OffsetTable OffsetTable;
sfnt_DirectoryEntry Table;
sfnt_NamingTable NamingTable;
sfnt_NameRecord NameRecord;
lpszLongName[0] = '\0';
if ((fp = fopen (pszFile, "rb")) == NULL)
{
return csOutName;
}
fread (&OffsetTable, 1, sizeof (OffsetTable) - sizeof(sfnt_DirectoryEntry), fp);
cTables = (int) SWAPW (OffsetTable.numOffsets);
for ( i = 0; i < cTables && i < 40; i++)
{
if ((fread (&Table, 1, sizeof (Table), fp)) != sizeof(Table))
{
return csOutName;
}
if (Table.tag == tag_NamingTable)
{
fseek (fp, SWAPL (Table.offset), SEEK_SET);
fread (&NamingTable, 1, sizeof (NamingTable), fp);
numNames = SWAPW(NamingTable.count);
while (numNames--)
{
fread (&NameRecord, 1, sizeof (NameRecord), fp);
curseek = ftell(fp);
if (SWAPW(NameRecord.platformID) == 1 &&
SWAPW(NameRecord.nameID) == 4)
{
fseek (fp, SWAPW (NameRecord.offset) +
SWAPW(NamingTable.stringOffset) +
SWAPL(Table.offset), SEEK_SET);
fread (&namebuf, 1, SWAPW(NameRecord.length), fp);
namebuf[SWAPW(NameRecord.length)] = '\0';
lstrcpy(lpszLongName,namebuf);
fseek (fp, curseek, SEEK_SET);
csOutName = lpszLongName;
}
}
break;
}
}
fclose (fp);
return csOutName;
}
Be very, very careful what you put into that head, because you will never, ever get it out. --Thomas Cardinal Wolsey
|
|
|
|
|
great help , Thank you
|
|
|
|
|
Is there a way to hide a running app from task manager? Can I hide this app so that it will not be seen when alt-tab is pressed?
Thanks!
----------------------
Senior Software Developer
William Dicks
http://www.nanoteq.com/
|
|
|
|
|
This seems like a "try google" type question, but I honestly have and can't find a tutorial anywhere.. so:
Where can I learn to create my own control for an MFC app using visual c++?
Cheers,
Rewbs
|
|
|
|