|
How to take "argc" (like comand line) in dialog based aplication?
|
|
|
|
|
|
GetCommandLine() in MFC.
~RaGE();
|
|
|
|
|
If you are not using MFC, it's also in your WinMain () fuction...
WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
Jeremy Falcon
|
|
|
|
|
GetCommandLine returns you a string (LPTSTR) to command line including the program name, so you can parse it. If you use MFC you have CWinApp::ParseCommandLine(...) and CCommandLineInfo object which does the job for you
Gil
|
|
|
|
|
big thanks
|
|
|
|
|
What is the easiest way to keep track of users logged into a database for signing in and out.
Thanks
|
|
|
|
|
Hello, I have a big time trouble with displaying more than 16 color icons in report view in my listview. I create a image list and load a bitmap containing the images, but they display really ugly (I think in 16 colors), and from that time on, My listview control looks ugly. Any ideas on displaying them the way they are?
Please provide code snipets,
Thanks,
Deian
|
|
|
|
|
Deian Popov wrote:
Please provide code snipets
I was hoping *you* could provide the code you have used to initialise your imagelist, so that *we* can help you.
~RaGE();
|
|
|
|
|
Depends on the ILC_COLORxx value you used when calling the CImageList::Create method and whether the Bitmaps you loaded into the image list are compatible with that (the VC resource editor only works in 16 colors...)
|
|
|
|
|
Thanks for the help, yes it turned that I did not set up a flag in my image list (ILC_COLOR32) I think. After passing the right flag, I got my icons looking the way they are
Thanks,
Deian
|
|
|
|
|
I am currently researching how to implement a feature for an article I am working on. I need to be able to create, on demand, a new email address to receive incoming email. This address will be managed by an agent application which reads incoming email and acts upon it appropriately.
I could require that users have an email server of their own. If I do this, is it required to have a DNS entry and MX records and all that OR can I just send email to someone@127.0.0.1 and have my email server receive it with no MX/external internet stuff? Ideally, I would like to put the email server on a different port than the standard POP3/SMTP ports (like 9921). Could I send an email to someone@127.0.0.1:9921 or somehing like that? If so, would all or most all email clients be able to handle that?
This is the method I think I am going to use, but before I spend too much time on it, I am hoping someone in the CP community can tell me if this would work.
Thanks in advance.
|
|
|
|
|
I have an SDI application with a tree control set in a form. The tree control has pop-up menus that appear when you click on item in the tree. However, sometimes when I'm running the mouse up and down on of the pop up menus, the program just crashes. It's otherwise stable and functional. Any ideas? I realize this is one of those "random crash" questions but has anyone else experienced something similar and come up with a way to avoid it??
|
|
|
|
|
When running your app in debug mode, your development tool should intercept the crash and position the cursor to the line of code where the crash has occured, or before if a assertion fails. You should then be able to find some explanations.
|
|
|
|
|
never happened
but i guess it will can any your code (look at your tree or dialog class)
(if your menu is not any subclassed problem too)
t!
|
|
|
|
|
As Sfan said, try to reproduce it under debug settings, and examine the call stack.
Might be one of your UpdateUI handlers crashing.
"Der Geist des Kriegers ist erwacht / Ich hab die Macht" StS
sighist | Agile Programming | doxygen
|
|
|
|
|
I guess it was a problem with the UI handlers!
I was using them the enable and disable some pop up menus and apparently I had mismatched them or used them for some overlapping calls. Anyway, I made a separate one for each possible combination and the crash seems to have dissapeared...Interesting.
*sample call*
void CSacmanSetupApplicationView::OnUpdateEditRectGate(CCmdUI* pCmdUI)
{
if(m_pGate && m_pGate->IsRectangular())
{
pCmdUI->Enable ( TRUE );
}
else
pCmdUI->Enable( FALSE );
}
|
|
|
|
|
|
hello i have add to my dialogBar one slider a i want to get the value of the slider when it move and i have add one variable RequiredCharacter :
void MyDialogBar::OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar) <br />
{<br />
if(pScrollBar)<br />
{<br />
CSliderCtrl * pSlider = (CSliderCtrl*)pScrollBar;<br />
<br />
if(pSlider->GetDlgCtrlID() == IDC_SLIDER1)<br />
{<br />
CString str;<br />
str.Format("%d", pSlider->GetPos());<br />
GetDlgItem(IDC_EDIT1)->SetWindowText(str);<br />
<br />
<br />
RequiredCharacter =pSlider->GetPos();<br />
<br />
<br />
}<br />
}<br />
CDialogBar::OnHScroll(nSBCode, nPos, pScrollBar); <br />
<br />
}<br />
<br />
and in App class i want to compare this value(of the slider when it move)
like this :
<br />
if(PtrDialogBar->RequiredCharacter > ptrScene->CharacterPos.size())<br />
{<br />
int amoun = PtrDialogBar->RequiredCharacter - ptrScene->CharacterPos.size();<br />
ptrScene->AddCharacter(amoun);<br />
}
PtrDialogBar is a pointer from the class when it was declared RequiredCharacter because it's note in the same class
CharacterPos it's a vector of structur
but it don't give any value when i scroll the slider ,can you hel me please?
|
|
|
|
|
where can i get a list of identifyers like char, int, sizeof, or whatever ya call em
|
|
|
|
|
|
|
Hi,
Ok here is the situation:
I have a piece of code which needs to save debug dumps during runtime for that I use MiniDumpWriteDump() function in an __except() block, because I need to call GetExceptionInformation() to receieve EXCEPTION_POINTERS.I also need to catch CMemoryException but as you know for that I must use catch() instead of __except(). And if I use that I wouldn't be able to call GetExceptionInformation().
So my question is how can I catch CMemoryExcpetion in an __except block or alternatively, how can I receive EXCEPTION_POINTER in a catch() block?
Any help appreciated!!!
Rob
|
|
|
|
|
Use standard try and catch and resort to _set_se_translator to transform SEH exceptions into C++ exceptions, just like the following code shows:
class SEH_exception:public std::runtime_error
{
public:
SEH_exception(unsigned int code,const char* msg):std::runtime_error(msg),code_(code){}
unsigned int code()const{return code_;}
private:
unsigned int code_;
};
static void SEH_translator(unsigned int code,EXCEPTION_POINTERS*)
{
std::string msg;
switch(code){
case EXCEPTION_ACCESS_VIOLATION: msg="access violation";break;
case EXCEPTION_ARRAY_BOUNDS_EXCEEDED: msg="array bounds exceeded";break;
case EXCEPTION_BREAKPOINT: msg="breakpoint exception";break;
case EXCEPTION_DATATYPE_MISALIGNMENT: msg="datatype misalignment";break;
case EXCEPTION_FLT_DENORMAL_OPERAND: msg="flt denormal operand";break;
case EXCEPTION_FLT_DIVIDE_BY_ZERO: msg="flt divide by zero";break;
case EXCEPTION_FLT_INEXACT_RESULT: msg="flt inexact result";break;
case EXCEPTION_FLT_INVALID_OPERATION: msg="flt invalid operation";break;
case EXCEPTION_FLT_OVERFLOW: msg="flt overflow";break;
case EXCEPTION_FLT_STACK_CHECK: msg="flt stack check";break;
case EXCEPTION_FLT_UNDERFLOW: msg="flt underflow";break;
case EXCEPTION_ILLEGAL_INSTRUCTION: msg="illegal instruction";
case EXCEPTION_IN_PAGE_ERROR: msg="in page error";break;
case EXCEPTION_INT_DIVIDE_BY_ZERO: msg="divide by zero";break;
case EXCEPTION_INT_OVERFLOW: msg="overflow"; break;
case EXCEPTION_INVALID_DISPOSITION: msg="invalid disposition";break;
case EXCEPTION_NONCONTINUABLE_EXCEPTION: msg="noncontinuable exception";break;
case EXCEPTION_PRIV_INSTRUCTION: msg="priv instruction";break;
case EXCEPTION_SINGLE_STEP: msg="single step trap";break;
case EXCEPTION_STACK_OVERFLOW: msg="stack overflow";break;
default:{
char buf[1024];
sprintf(buf,"SEH exception (%x)",code);
msg=buf;
}
break;
}
throw SEH_exception(code,msg.c_str());
}
...
_set_se_translator(SEH_translator);
...
try{
...
}
catch(SEH_exception& e){
...
}
catch(CMemoryException& e){
...
} I guess you can modify the example given to suit your needs. Good luck.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Thanks that helped alot!
|
|
|
|