|
The EnumChildWindows function enumerates the child windows that belong to the specified parent window by passing the handle to each child window, in turn, to an application-defined callback function. EnumChildWindows continues until the last child window is enumerated or the callback function returns FALSE.
You can enumerate the child windows of oyur dialog, see if the grid show up in the list.
Use Spy++ to get window handle of grid while it is on screen.
That can help you figure out what is wrong.
|
|
|
|
|
|
Hi,
Iam new to MFC & I tried your "EnumChildWindows" function where I gotinto some trouble.
I have a class "C_PropView" which is derived from CDialog.
Under
"BOOL C_PropView::OnInitDialog() "
{
//I called the functions
RECT rcClient;
GetClientRect(&rcClient);
::EnumChildWindows((HWND)this, EnumChildProc,(LPARAM) &rcClient);
"EnumChildProc",I declared it as follows in my "C_PropView.h" file but outside the class,but this function is never getting called from the "onInitDialog", I have to declare "Extern C" declarations co's I got some calling convention errors.
static BOOL CALLBACK EnumChildProc(HWND hwndChild, LPARAM lParam)
{
return TRUE;
}
Would be nice if you could help...
|
|
|
|
|
I think this will work.
You need to add a public member function BOOL HandleChildEnum(HWND) to your view class.
If this does not work, then you can not enumerate from within the OnInitDialog, and a message will have to be posted to yourself to cause the enumeration.
// global function maps from global space to class space
BOOL CALLBACK MyEnumChildProc(
HWND hwndChild,
LPARAM lParam
){
// lParam was apointer to 'this' a C_PropView
C_PropView* pMyView = (C_PropView*)lParam;
// now call function within context of the class data
return pMyView->HandleChildEnum(hwndChild);
}
// now you have access to all your member variables and are within t he // context of your class BOOL C_PropView::HandleChildEnum(
HWND hWindowChild
){
return TRUE;
}
// call the child window enumerator
// make sure
BOOL C_PropView::OnInitDialog()
{
// make sure to call base class
// first, so all the MFC crap is initialized
CDialog::OnInitDialog();
// enumerate child windows
// passing in our window, the local function, and a point to 'this'
::EnumChildWindows(m_hWnd, MyEnumChildProc, (LPARAM)this);
}
|
|
|
|
|
Hi,
I would like to convert int i = 7 to char , how can I do this?
Regards,
-
When in doubt, push a pawn!
-
|
|
|
|
|
Hy,
That depend on what you need, char = 0x07 or char = '7'
|
|
|
|
|
char = '7'
-
When in doubt, push a pawn!
-
|
|
|
|
|
You can use on of :
sprintf, itoa ...
of this pseudo code
<br />
int = nex_digit<br />
while(int)<br />
char = 0x30+int
|
|
|
|
|
I would like to run this function in my C++ code;
void convertToBinary( int numberToConvert )<br />
{<br />
if(!(( N / 2 ) < 1 ))<br />
{<br />
binaryRepresentation[counter] = ( N % 2 );<br />
counter++;<br />
convertToBinary( N /= 2 );<br />
}<br />
}
but binaryRepresentation[counter] = ( N % 2 ); line of code does not work friend?
-
When in doubt, push a pawn!
-
|
|
|
|
|
I don't understend what meen N in this code
For binare representation of value i use this function:
<br />
char* BinPrintf(int value)<br />
{<br />
char tmp[256];<br />
memset(tmp, 0, 256);<br />
int tpos = 0;<br />
<br />
while(value)<br />
{<br />
tmp[tpos++] = 0x30+value%2;<br />
value = value >> 1;<br />
}<br />
<br />
char *ret = new char[strlen(tmp)+1];<br />
memset(ret, 0, strlen(tmp)+1);<br />
tpos = strlen(tmp)-1;<br />
value = 0;<br />
while(tpos > -1)<br />
ret[value++] = tmp[tpos--];<br />
<br />
return ret;<br />
}<br />
|
|
|
|
|
Mad__ wrote:
char *ret = new char[strlen(tmp)+1];
memset(ret, 0, strlen(tmp)+1);
tpos = strlen(tmp)-1;
value = 0;
while(tpos > -1)
ret[value++] = tmp[tpos--];
This code could simply be replaced with a call to strrev(tmp) .
"Opinions are neither right nor wrong. I cannot change your opinion of me. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
I assume binaryRepresentation is some sort of char array, and that N is actually numberToConvert . That being the case, what you have is working, but you are confusing 0 (ASCII 0) and '0' (ASCII 48). You simply need to change the statement to:
binaryRepresentation[counter] = (char) ((N % 2 ) + 48); Now binaryRepresentation[counter] will contain '0' if N is an even number and '1' if N is an odd number.
Of course, if you wanted to use a "built-in" solution, you could simply use itoa(numberToConvert, binaryRepresentation, 2) .
"Opinions are neither right nor wrong. I cannot change your opinion of me. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
Thanks all for help, I solved it...
-
When in doubt, push a pawn!
-
|
|
|
|
|
<font color=#0000FF>char</font> c;
sscanf("7", "%s %c", &c);
TOXCCT >>> GEII power
|
|
|
|
|
When I made
sscanf( static_cast<char>( N % 2 ) , "%s" , &binaryRepresentation[counter] );
Compiler gives an error like
cannot convert parameter 1 from 'char' to 'const char *
I'm a newbie in C++,
Regards.
-
When in doubt, push a pawn!
-
|
|
|
|
|
kromozom wrote:
sscanf( static_cast( N % 2 ) , "%s" , &binaryRepresentation[counter] );
that's normal, you associate a char with %s
do this :
sscanf( static_cast( N % 2 ) , "%<font color=#FF0000>c</font>" , &binaryRepresentation[counter] );
TOXCCT >>> GEII power
|
|
|
|
|
When I type;
sscanf( static_cast<char>( N % 2 ) , "%c" , &binaryRepresentation[counter] );
Same error occurs, cannot convert char to const char*
Regards,
-
When in doubt, push a pawn!
-
|
|
|
|
|
That is because static_cast( N % 2 ) is not a pointer to a char. I don't know what it is, because N is unknown to me...
Take a look at the prototype of sscanf[^] and then start wondering how you should pass the parameters...
Besides that, the solution that Mad__ gave you looks like what you want...
Multiply it by infinity and take it beyond eternity and you'll still have no idea about what I'm talking about.
|
|
|
|
|
Hi,
can use _itoa(..) function. Have a look @ msdn. it does have a sample too.
Sujan
|
|
|
|
|
Hello all,
In application I am facing handle leak problem.
I am using dev partner tool and oh.exe from MS to trace the leak. But after getting the information from oh.exe I am unable to understand how to get in the code.
for example: using oh.exe i can find that
" 00000ADC gpb.exe File 09e4 \DOCUME~1\E669267\LOCALS~1\Temp\~DFB472.tmp " handle is getting leaked.
Now can you suggest how to locate code with respect to this leak.
Thanks & regards,
Jokhan
|
|
|
|
|
Hi,
I have a toolbar. On click of toolbar button I added a Popup menu. Now when I click on any one of the Popup menu sub item, the toolbar button state should be sunken similar to normal menu.
Can anyone pls help me in this.
Thnaks
Madhavi
|
|
|
|
|
Hi,
Think u must have 2 use something like
CMainFrame *pFrame = (CMainFrame *) GetParentFrame();
TBBUTTONINFO tbi;
tbi.dwMask= TBIF_STYLE;
tbi.cbSize= sizeof(TBBUTTONINFO);
pFrame->m_wndToolBar.GetToolBarCtrl().GetButtonInfo(ID_FILE_SAVE, &tbi);
tbi.fsStyle |= TBSTATE_PRESSED;
pFrame->m_wndToolBar.GetToolBarCtrl().SetButtonInfo(ID_FILE_SAVE, &tbi);
Sometimes this may help u
Sujan
|
|
|
|
|
is there any way i can trace the function where the breakpoint function was reached. I've tried the "crash finder" application but that couldnt trace the function either. I've put exception handlers all over but the application crashes at some point. The application always crashes at the same address and i cant really trace the condition where this is happening. I am writing all my the function names in a file to trace the condition but the application breaks off at a different point with the same address location. Any ideas people?
|
|
|
|
|
have a look at the functions call stack, the processor registers and so useful debuging tools.
otherwise, if you want some help, post a piece of the crashing code...
TOXCCT >>> GEII power
|
|
|
|
|