|
I seached in MSDN, and it told me what the functions do. Again, I am very new to all of this. What..would...the..code be so I could link the checking button to the checking dialog window, and the savings button to the savings dialog window. How would I use OpenFileName() and SaveFileName()?
Mike -- I code because I love to
|
|
|
|
|
<font color=#0000FF>void</font> CATM_gui1Dlg::OnSavings() {
<font color=#0000FF>char</font> strDestFile[260] = <font color=#808080>""</font>;
OPENFILENAME file;
<font color=#008000>
ZeroMemory(&file, <font color=#0000FF>sizeof</font>(file));
file.lStructSize = <font color=#0000FF>sizeof</font>(file);
file.hWndOwner = <font color=#0000FF>this</font>->m_hWnd;
file.lpstrFile = strDestFile;
file.nMaxFile = <font color=#0000FF>sizeof</font>(strDestFile);
file.lpstrFilter = <font color=#808080>"Text files\0*.TXT\0"
"All files\0*.*\0"</font>;
file.nFilterIndex = 0;
file.lpstrFileTitle = NULL;
file.nMaxFileTitle = 0;
file.lpstrInitialDir = NULL;
file.Flags = OFN_OVERWRITEPROMPT |
OFN_PATHMUSTEXIST;
<font color=#008000>
<font color=#0000FF>if</font> (GetSaveFileName(&file) == TRUE) {
<font color=#008000>
}
}
TOXCCT >>> GEII power
|
|
|
|
|
I think you're getting the wrong end of the stick - he's talking about a Savings dialog - i.e. a dialog for his ATM application that shows the user's financial savings (not a file save dialog)
--
Help me! I'm turning into a grapefruit!
Phoenix Paint - back from DPaint's ashes!
|
|
|
|
|
Do you want to keep the CATM_gui1Dlg window open, or do you want to replace it with the new dialog
To show another dialog, you need to
CSavingsDlg dlg;
dlg.DoModal();
Michael
CP Blog [^]
|
|
|
|
|
If the Savings and the Cheking class are derived from CDialog (which they should be...) then take a look at CDialog::DoModal(). This will show the dialog in a modal state. (Information found in MSDN)
If you want the ATM window to be invisible, then call ShowWindow(SW_HIDE) before the DoModal() call..
Hope this solves your problem.
Multiply it by infinity and take it beyond eternity and you'll still have no idea about what I'm talking about.
|
|
|
|
|
not exactly, you cannot write into a CString with operator[]
TOXCCT >>> GEII power
|
|
|
|
|
hi,
I ve got a non MFC DLL that is aleady developped.. However, I d like to add this version window to my DLL. But I dunno how to do it.
I did create a ressource file that I have added to my project with the code of the ressource in it. But it doesnt make any difference. I came across a tutorial on the web to do this... but it used the STL, which seems a bit too far fetched to me.
I reckon this is not complicated and there is an easy way to do it, but this is always the same: it is easy once u've done it.
If somebody could help me out, would me nice
cheers.
bob
|
|
|
|
|
I am not sure what you mean by 'version window'
Do you possibly mean you want to add a version RESOURCE so that you can see the file version information when you get properties from Explorer, for example?
|
|
|
|
|
I have a ListCtrl with about 50 rows by 6 cols being updated every second. There is quite a bit of flicker and I have tried the following to reduce it:-
m_cSignalList.SetRedraw(FALSE); <br />
... <br />
... <br />
Update the items on the control <br />
... <br />
... <br />
<br />
m_cSignalList.SetRedraw(TRUE); <br />
m_cSignalList.Invalidate(); <br />
m_cSignalList.UpdateWindow();
Are they anything else I can do?
|
|
|
|
|
I think your only option is to make the control owner-drawn and draw to an off-screen bitmap and then copy it into the control's DC. That's a pretty big undertaking.
Try looking for a list control on CP that can do it for you.
The opinions expressed in this communication do not necessarily represent those of the author (especially if you find them impolite, discourteous or inflammatory).
|
|
|
|
|
Thanks, I will have a look.
|
|
|
|
|
Just curious, but are the calls to Invalidate() and UpdateWindow() necessary?
"Opinions are neither right nor wrong. I cannot change your opinion of me. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
Hi Guys,
Iam working on VisualStudio MFC & have run into a problem.
I have a dialog & have placed on this Dialog command buttons,labels & componentone studio VsFlexGrid activex control at DesignTime(In ResourceEditor).
I use the "GetDlgItem" method:
HWND GetDlgItem(
HWND hDlg,
int nIDDlgItem);
-->For getting the windowhandle of the specified control.
For commandbuttons,Labels It gives me a valid handle back,but for the "VSFlexGrid" It gives me a NULL back.
Is there any other alternative function other than "GetDlgItem" so that it gives me a valid handle for all my controls within the dialog.
or Is there any other alternative way
Any help is appreciated....
Thanks...
|
|
|
|
|
CButton * pButton = (CButton*)GetDlgItem(IDC_MY_BUTTON);
pButton->SetWindowText(<font color=#008000></font>);
TOXCCT >>> GEII power
|
|
|
|
|
are you sure the dialog is Create d before you use GetDlgItem ?
Are you sure the flexgrid is also created ? ) use CWnd::GetSafeHwnd() to check. )
Maximilien Lincourt
Your Head A Splode - Strong Bad
|
|
|
|
|
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 />
|
|
|
|