|
robert_s wrote:
return TRUE; // return TRUE unless you set the focus to a control
TOXCCT >>> GEII power
|
|
|
|
|
Thanks toxcct ) Returning FALSE fixes the problem
HAHA!!! S*** I haven't noticed these comments generated by a wizard. How embarassing....
Sorry!
But still its a bit silly to me to return FALSE. The function name (OnInitiDialog) suggests that I am initializing a dialog and if successfully initialized it should return TRUE otherwise FALSE if unsuccessful. But here even though the dialog is initialized I am returning FALSE. hehe! I cant see any logic here? Perhaps I still need to learn more the way how MS people think ) hehe..
Thanks all for help!!
|
|
|
|
|
robert_s wrote:
But still its a bit silly to me to return FALSE. The function name (OnInitiDialog) suggests that I am initializing a dialog...
The return value has nothing to with success/failure. It simply denotes whether the application has set the input focus to one of the controls in the dialog box.
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
hello,
do you know the name of any book that explain how to program a cd writer I need to know how to burn cds -erase cds etc.
Thanks in advance
|
|
|
|
|
|
I would like to know how create child windows at runtime and get them all displyed
Yes I've used:
- a pointer for the control
- the new operator for the window type
- CWnd::Create method
- CWnd::ShowWindow method
- CWnd::MoveWindow method
All I'm getting is a blank dialog box. I can't understand why.
What do I have to do display them?
|
|
|
|
|
Please show us a little bit of your source code...
|
|
|
|
|
This is a snippets of my code
in the dialog header file
class CMyDialouge : public CDialog{<br />
public CEdit *m_EditWnd;<br />
CRect m_WndRect;<br />
};
The dialog's constructor
CMyDialouge::CMyDialouge(CWnd* pParent )<br />
: CDialog(CMyDialogue::IDD, pParent)<br />
{<br />
m_EditWnd = NULL;<br />
m_Rect = CRect(23,30,54,14);<br />
}<br />
Create 5 versions of the edit control
BOOL CMyDialouge::OnInitDialog()<br />
{<br />
this->m_EditWnd = new CEdit[5];<br />
<br />
for(int i = 0; i < 5; i++)<br />
{<br />
m_EditBox[i].Create(WS_CHILD|ES_MULTILINE| WS_VISIBLE|ES_WANTRETURN,CRect(0,0,0,0),this,1000 + i);<br />
m_EditWnd[i].MoveWindow(m_Rect);<br />
m_EditWnd[i].ShowWindow(SW_SHOW);<br />
<br />
m_Rect.top += 30;<br />
}<br />
return TRUE;
<br />
}
void CMyDialouge::OnDestroy<br />
{<br />
for (int i=0; i <5; i++)<br />
m_EditWnd[i].DestroyWindow();<br />
<br />
CDialog::OnDestroy();<br />
<br />
delete[] m_EditWnd;<br />
}<br />
I hope I've clarified it.
Thanks Alton
|
|
|
|
|
In CMyDialouge::OnInitDialog() you wrote
m_EditBox[i].Create(WS_CHILD|ES_MULTILINE| WS_VISIBLE|ES_WANTRETURN,CRect(0,0,0,0),this,1000 + i);
m_EditWnd[i].MoveWindow(m
You used m_EditBox AND m_EditWnd, may it be that this is your mistake?
Jens
|
|
|
|
|
Jens Doose wrote:
m_EditBox[i].Create(WS_CHILD|ES_MULTILINE| WS_VISIBLE|ES_WANTRETURN,CRect(0,0,0,0),this,1000 + i);
Correct to (compiler will complain):
m_EditWnd[i].Create(WS_CHILD|ES_MULTILINE| WS_VISIBLE|ES_WANTRETURN,CRect(0,0,0,0),this,1000 + i);
|
|
|
|
|
You used CRect(23,30,54,14); as the location to move the window to.
This statement create a rect with the following settings:
- m_Rect {top=30 bottom=14 left=23 right=54}
- tagRECT {top=30 bottom=14 left=23 right=54}
left 23
top 30
right 54
bottom 14
Since "bottom" is less than "top" this is a rect with a negativ height.
I am pretty sure that was not your intention, was it?
Jens
|
|
|
|
|
Most of the time, creating controls at runtime is not necessary. Can you explain a bit more of what you are doing?
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
I just wanted to play around with dynamic controls
I've given code snippets in the reply before yours.
Thanks Alton
|
|
|
|
|
Yes, I understand!! I'm trying to create a MenuBar at runtime but all itens in the menu is GRAYED (disabled) when created!!! I don't know why?!?!?
Maybe some help in your doubt helps in mine!!!
Thanks
Marcos Vinícius
|
|
|
|
|
If your using MFC one of the more common mistakes is that there is no command handler yet. In that case MFC grayes all the unavailable menu commands.
Jens
|
|
|
|
|
But, why is it unavailable? I can't just put a Message_Map in my class that handle the App MenuBar and that will enable the MenuItens?
Take a look in my last thread posted:
Menu at runtime (dynamic menu)
Thanks.
Marcos Vinícius
|
|
|
|
|
okay here it goes ...
my app crashes cause of a DLL (coded correctly)
my DLL is accessing to a file, only to read ...
isn't it allowed to a dll to read a file? how to fix it ?
is there maybe another error?
Its a simply Win32 dll with CPP, Header and Def file
and my app is a console app (MFC apps crash too)
the debugger links me to "output.c"
if i write other console apps it crashes too ...
can any1 help me?
int main(int argc, char* argv[])<br />
{<br />
if (argc < 2)<br />
{<br />
printf ("Usage is: <CharFile> \n");<br />
getchar();<br />
return 1;<br />
}<br />
char * output = "";<br />
char hash[5] = "abcd";
char * outputfile = "";<br />
sprintf(outputfile,"%s.txt",argv[1]);<br />
FILE * fp = fopen(argv[1],"r");<br />
FILE * f = fopen(outputfile,"wt");<br />
<br />
if (!fp)<br />
{<br />
printf ("Error opening file %s\n", argv[1]);<br />
getchar();<br />
return 2;<br />
}<br />
int findex = 0;<br />
unsigned char d;<br />
while (!feof(fp)) <br />
{<br />
int c = fgetc(fp);<br />
if (c == EOF) break;<br />
unsigned char k = (hash[findex % 4] + findex) % 256;<br />
d = c ^ (k | 0x80);<br />
findex++;<br />
output += (char) d;<br />
fprintf(f,(const char *) d);<br />
}<br />
fclose(fp); <br />
fclose(f);<br />
return 0;<br />
}
|
|
|
|
|
How can I move the caret in an CEdit control forward or backward in characters, not in coordinates?
SmileAgain
|
|
|
|
|
Perhaps CEdit::SetSel (nCharPos, nCharPos, TRUE) ?
/ravi
My new year's resolution: 2048 x 1536
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
Hi,
I want to create the following splitters.
1. ParentSplitter - 2 cols and 1 row (vertical split)
- derives from CFrameWnd-SDI based
- 1st pane has a class derived from CTreeView (so this will be SDI-based)
- 2nd pane should be ChildSplitter
2. ChildSplitter - 2 rows and 1 col (horizontal split)
- derives from CMDIChildWnd-MDI based
- 1st pane and 2nd pane will derive from CFormView
So basically I want the parent to be SDI-based as its 1st pane (the TreeView) is SDI-based but its 2nd pane needs to be a MDI-based splitter. this application should look more or less like visual studio 6 having a tree on the left pane and double-clicking on a file should open a new window on the right pane ...
Can this be done? .. or is there any work-around for this concept .. If so can anyone plz guide me ...
thanks a lot
|
|
|
|
|
I faked this by creating a standard MDI app, using a docking window for the tree view. My "tree view" is actually a dialog template that houses a tab control, which displays various views (tree, list) of the open "project". It seems you're trying to do the same thing.
/ravi
My new year's resolution: 2048 x 1536
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
I made a simple prog in console that listed ALL the ip's that are possible... don't ask, and I stumbled onto a problem, I was storing those ip's into a txt file, but when the ip's were only on 1.0.0.0 the txt file was aproximatly 200mb, you know .2gb, anyways does anyone know how to make that file smaller or is that the smallest I can get?
Actual Linux Penguins were harmed in the creation of this message.
|
|
|
|
|
There are a few ways I can think of, but it's hard without more information.
1. Don't store it as text, save them as binary groups of four bytes
2. Only store the changes between each digit (0.0.0.[x0, x1, .. x254, x255], 0.0.1.[x0, x1, .. x254, x255], ...)
3. Don't save them at all, just generate them on the fly, this would be ideal but it depends on your situation.
If you can keep you head when all about you
Are losing theirs and blaming it on you;
If you can dream - and not make dreams your master;
If you can think - and not make thoughts you aim;
Yours is the Earth and everything that's in it.
Rudyard Kipling
|
|
|
|
|
Snyp wrote:
ALL the ip's that are possible...
I second Andrew's suggestion: there's no need to store these on disk - simply generate them on the fly.
/ravi
My new year's resolution: 2048 x 1536
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
I just wanted to do this for fun, to see what and how large it would be, I have a 30 gig hard drive and I calculated the document to come out aproximatly 50 gigs!!!!
Actual Linux Penguins were harmed in the creation of this message.
|
|
|
|