|
Cause your instance of combobox has not been existed yet, of cause it will crash.
Try to put
SetCurSel(0)
in your WM_INITDIALOG handler.
Sonork 100.41263:Anthony_Yio
|
|
|
|
|
In this line "settingsDlg.m_ctrlCenterStyle.SetCurSel(0);"
u r trying to use combobox object when actually it is not created ,cauz it is before DoModal statement
Write this statement
m_ctrlCenterStyle.SetCurSel(0); in the OnInitDialog member of ure dialog class , all initialization and settings of dialog controls should be done here
No Worries!
|
|
|
|
|
Hello,
I created a Regular Dll that should display a Dialog Box so that the user can enter some information. But when i call my dll using a regular c application nothing gets display to the user. I am kinda lost. I started by creating a regular dll with the option of using MFC libs using vc++ 6.0. I exported a function which calls my Dialog box class:
extern "C" __declspec(dllexport) long CallDlg()
{
AFX_MANAGE_STATE(AfxGetStaticModuleState());
CmcDlg dlg;
dlg.DoModal();
DWORD dw = GetLastError();
printf("failed: GetLastError returned %u\n", dw);
return 0;
}
The dlg.DoModal() function does not start anything. Here is how my dialog class:
// mcDlg.cpp : implementation file
//
#include "stdafx.h"
#include "MFCdll.h"
#include "mcDlg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CmcDlg dialog
CmcDlg::CmcDlg(CWnd* pParent /*=NULL*/)
: CDialog(CmcDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CmcDlg)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
}
void CmcDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CmcDlg)
// NOTE: the ClassWizard will add DDX and DDV calls here
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CmcDlg, CDialog)
//{{AFX_MSG_MAP(CmcDlg)
ON_BN_CLICKED(IDC_Add, OnAdd)
ON_BN_CLICKED(IDC_Multiply, OnMultiply)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CmcDlg message handlers
void CmcDlg::OnAdd()
{
// TODO: Add your control notification handler code here
int iVar1 = GetDlgItemInt( IDC_EDIT1 );
int iVar2 = GetDlgItemInt( IDC_EDIT2 );
int iRes = iVar1 + iVar2 ;
SetDlgItemInt( IDC_EDIT3, iRes, TRUE );
UpdateData(FALSE);
}
void CmcDlg::OnMultiply()
{
// TODO: Add your control notification handler code here
int iVar1 = GetDlgItemInt( IDC_EDIT1 );
int iVar2 = GetDlgItemInt( IDC_EDIT2 );
int iRes = iVar1 * iVar2 ;
SetDlgItemInt( IDC_EDIT3, iRes, TRUE );
UpdateData(FALSE);
}
void CmcDlg::OnOK()
{
// TODO: Add extra validation here
CDialog::OnOK();
}
void CmcDlg::OnCancel()
{
// TODO: Add extra cleanup here
CDialog::OnCancel();
}
Anybody knows why? Thanks in advance for you help.
|
|
|
|
|
You may need to use AfxSetResourceHandle(): Did you check in debug where it fails?...
"...Ability to type is not enough to become a Programmer. Unless you type in VB. But then again you have to type really fast..."
Me
|
|
|
|
|
It fails at the point where I am calling the dlg.DoModal();
It returns -1. That's it.
|
|
|
|
|
Is there an API, or method, to create a file and lock part of it in an atomic operation?
(This has to work with a common directory on a network where the source systems don't know about each other, so Mutexes are out.)
Anyone who thinks he has a better idea of what's good for people than people do is a swine.
- P.J. O'Rourke
|
|
|
|
|
Not in the win32 api. You might be able to do this with a device driver though.
John
|
|
|
|
|
Why not create the file with "exclusive" access?
Neville Franks, Author of ED for Windows. Free Trial at www.getsoft.com
|
|
|
|
|
Neville Franks wrote:
Why not create the file with "exclusive" access?
That would prevent read access to a portion of the file.
Anyone who thinks he has a better idea of what's good for people than people do is a swine.
- P.J. O'Rourke
|
|
|
|
|
Joe Woodbury wrote:
That would prevent read access to a portion of the file.
Only from another process. If you are just creating the file and you want to lock it straight away then it sounds like you don't want any other process to access it anyway. Not much in it for them anyway, seeing it is empty.
Neville Franks, Author of ED for Windows. Free Trial at www.getsoft.com
|
|
|
|
|
Neville Franks wrote:
Only from another process.
Exactly.
I need to create a file and lock the whole file. I then write the header and additional data and then change the lock to cover only the additional data so only the header is readable.
During the create process, the file must be locked. Once created, all but the first 16 bytes must be locked. If I create the file, then reopen it, there are synchronization problems. A Mutex solves this on a single workstation, but not if the file is being accessed from multiple clients in a shared directory. The ugly solution is to create a guard file except there is a situation where one of the clients could be opening the file in read only mode (and the target directory is read only.)
All this could be solved by allowed a create and lock in an atomic operation. (Actually, if I could have the entire creation process as a single transaction, that would be perfect. But since the shared directory may not even be Win32, this isn't viable.
Anyone who thinks he has a better idea of what's good for people than people do is a swine.
- P.J. O'Rourke
|
|
|
|
|
I have a file where i am getting the name from a file:
inpf.get(name,15);
How can I check if I get a name and it is true?
|
|
|
|
|
How about submitting a question that actually makes sense?
Anyone who thinks he has a better idea of what's good for people than people do is a swine.
- P.J. O'Rourke
|
|
|
|
|
With the lack of information you've provided, an answer is going to be difficult to provide.
What is inpf , and name ? Why is the number 15 hard-coded?
Provide a realistic code snippet and you're bound to get more help!
Five birds are sitting on a fence.
Three of them decide to fly off.
How many are left?
|
|
|
|
|
Somebody asked here about libraries for burning. I searched for them (free ones) and I couldn't find anyone. I think it may be useful for lots of apps and I would like to suggest TheCodeProject to add into web's downloads one, because I think that this is the best programmer-to-programmer web site. If anyone can tell where can we find libraries or a library for burning CDS through VC++, please tell.
Thank you very much.
Written by: Rafael Fernández López.
void life ( bool me, bool her )
{
while ( her )
{
me = true ;
}
else
{
me = false ;
} }
|
|
|
|
|
The title of this just cracked me up.
Rafael Fernández López wrote:
Somebody asked here about libraries for burning.
There are just too many wise-ass responses to add here.
Anyone who thinks he has a better idea of what's good for people than people do is a swine.
- P.J. O'Rourke
|
|
|
|
|
What's wrong there ?? I meant any libraries for burning data into cds... what's wrong with that ?? Think about that I'm not english, I'm spanish so maybe I am not saying the same as I would like to.
Sorry if I said something that you didn't like.
Written by: Rafael Fernández López.
void life ( bool me, bool her )
{
while ( her )
{
me = true ;
}
else
{
me = false ;
} }
|
|
|
|
|
Rafael Fernández López wrote:
Re: About burning libraries...
Sorry if I said something that you didn't like.
He reffered to burning the library like the library of Alexandria. As this has been already done when the arab caliph conquered Egypt (in AD.600 and something), the next on the list would be the British Library or the Library of Congress.
I fear that this text set me on quite a lot homedefence watchlists.
Who is 'General Failure'? And why is he reading my harddisk?!?
|
|
|
|
|
There is a syntax error in your sig. There is no else in a while loop!
Rickard Andersson
Here is my card, contact me later!
UIN: 50302279
Sonork: 37318
|
|
|
|
|
arrrrrgghhhhh, hahahahhaha. this is just making me mad... I'm gonna change it just now !! Thnx
Written by: Rafael Fernández López.
void life ( bool me, bool her )
{
while ( her )
{
me = true ;
}
else
{
me = false ;
} }
|
|
|
|
|
Rafael Fernández López wrote:
life(bool me, bool her)
{
while(her)
{
me = true ;
}
else
{
me = false ;
}
}
Will this compile?
|
|
|
|
|
hhahahahaha, someone told me too. I didn't notice what I wrote... I did it too fast. Thanks.
Written by: Rafael Fernández López.
void life ( bool me, bool her )
{
if ( her )
{
me = true ;
}
else
{
me = false ;
} }
|
|
|
|
|
Rafael Fernández López wrote:
void life ( bool me, bool her )
{
if ( her )
{
me = true ;
}
else
{
me = false ;
}
}
Actually, your first idea was better (but syntactically challenged) - since a while loop would continue forever as long as her was TRUE. The way it is now, life will only check once for the value of her and then terminate (hopefully peacefully while you sleep)
void life(bool me, bool her)
{
while(her)
{
me = true;
}
me = false ;
}
|
|
|
|
|
|
I know but none of them is free. Thanks.
Written by: Rafael Fernández López.
void life ( bool me, bool her )
{
if ( her )
{
me = true ;
}
else
{
me = false ;
} }
|
|
|
|