|
Does anyone know if the Job Object API supports setting up jobs on a remote machine, or if it only works locally? If you have a link that would be great also...TIA
|
|
|
|
|
There appear to be a weird problem here.
I open VS. Build, Run the program. Works fine. Now Build, Run again, and va_arg does not return NULL after the last arg. Now I close VS, open it again. Same process from here.
Anyone had these problems? Or can replicate them? Or fix them?
leppie::AllocCPArticle(Generic DFA State Machine for .NET);
|
|
|
|
|
There's no end-of-list mark with variable argument lists. You've been lucky so far that, sometimes, the next item on the stack has been zero.
You need to either look for a terminator value, or know how many items are in your list (by, for example, passing that as the first argument).
|
|
|
|
|
|
hmm, maybe, but then you'll loose some of the type of comfort that (...) provides. Imagine that before every printf() you have to prepare a linked list of arguments :-/.
But on the other side, the ... parameters doesn't have the type control, so it's some sort of evil
|
|
|
|
|
|
Any way, that allows you to detect end of the parameter list is acceptable. With the NULL backstop is only one disadvantage which comes to mind when you really need to pass some NULL as a valid value to one of normal parameters.
|
|
|
|
|
I created a Modaless dialog from my application, how can I detect that the dialog has lost focus (ex when the user clicks within the parent window and the dialog box is still there. I need this b/c without it new Modaless dialog boxes can be created with the existing one there.
-Steven Hicks
CPACodeProjectAddict
|
|
|
|
|
One solution is to add a handler for WM_KILLFOCUS.
Kuphryn
|
|
|
|
|
who to flush the receivebuffer of the serial interface (com1)
|
|
|
|
|
How are you currently reading from it?
|
|
|
|
|
#ifndef MESSGERAETE_H
#define MESSGERAETE_H
#include "windows.h"
class Messgeraete{
public:
Messgeraete();
~Messgeraete();
void takeValues();
double getValue(int value);
void stopThread();
//-1: Messung wurde abgerochen, 0 keine gütligen Werte, 1 gültige Werte wurden gelesen
int getMessflag();
static DWORD messenThread(LPVOID);
private:
HANDLE h_com;
HANDLE h_messThread;
DCB dcb;
COMMTIMEOUTS cto;
double value1, value2;
int messflag;
};
#endif
Messgeraete::Messgeraete(){
messflag=0;
h_com = CreateFile("COM1", GENERIC_READ | GENERIC_WRITE, 0, NULL, OPEN_EXISTING, 0 , NULL);
DCB dcb_neu;
COMMTIMEOUTS cto_neu;
GetCommState(h_com, &dcb);
GetCommState(h_com, &dcb_neu);
dcb_neu.BaudRate = 9600;
dcb_neu.ByteSize = 8;
dcb_neu.Parity = NOPARITY;
dcb_neu.StopBits = ONESTOPBIT;
SetCommState(h_com, &dcb_neu);
GetCommTimeouts(h_com,&cto);
GetCommTimeouts(h_com,&cto_neu);
cto_neu.ReadTotalTimeoutConstant=0;
cto_neu.ReadTotalTimeoutMultiplier=0;
SetCommTimeouts(h_com,&cto_neu);
}
Messgeraete::~Messgeraete(){
SetCommTimeouts(h_com,&cto);
SetCommState(h_com, &dcb);
CloseHandle(h_com);
}
DWORD Messgeraete::messenThread(LPVOID lparam){
Messgeraete *mp = (Messgeraete*)lparam;
int i;
unsigned long nBytesRead1,nBytesRead2;
char inbuffer1[13];
char inbuffer2[13];
char temp[9];
temp[8]=0;
ReadFile(mp->h_com, &inbuffer1, 13, &nBytesRead1, NULL);
ReadFile(mp->h_com, &inbuffer2, 13, &nBytesRead2, NULL);
// CString str;
// str.Format("%s\n%s",inbuffer1,inbuffer2);
// AfxMessageBox(str);
for(i=0;i<8;i++) temp[i]=inbuffer1[i+4];
mp->value1=atof(temp);
for(i=0;i<8;i++) temp[i]=inbuffer2[i+4];
mp->value2=atof(temp);
if(inbuffer1[0]=='9'){mp->value1=-1;AfxMessageBox("Messschieber ist nicht eingeschaltet oder nicht richtig angeschlossen");}
if(inbuffer2[0]=='9'){mp->value2=-1;AfxMessageBox("Messuhr ist nicht eingeschaltet oder nicht richtig angeschlossen");}
mp->messflag=1;
return 0;
}
void Messgeraete::takeValues(){
messflag=0;
h_messThread=CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)messenThread, (LPVOID)this, 0, NULL);
}
double Messgeraete::getValue(int value){
if (value==1) return value1;
else return value2;
}
void Messgeraete::stopThread(){
DWORD dw;
GetExitCodeThread(h_messThread, &dw);
TerminateThread(h_messThread, dw);
value1=value2=-1;
messflag=-1;
}
int Messgeraete::getMessflag(){ return messflag; }
|
|
|
|
|
|
doesn't work
in msdn is writte:
If hFile is a handle to a communications device, the function only flushes the transmit buffer.
I want to flush the receive buffer
any ideas?
|
|
|
|
|
Hi David,
Solution was this command
Thanks for you help
PurgeComm(h_com,PURGE_RXCLEAR);
|
|
|
|
|
yes, the debugging version is working okay, and the release version crashed.
It's a SDI project. After the release version run for about 5 seconds, this error message pop up:
"First-chance exception in MyApp.exe: 0xC0000005: Access Violation."
The call stack is:
CWnd::AttachControlSite(CWnd * const 0x010b7b2c {CMapPtrToPtr}, CHandleMap * 0x010b7b28) line 420
CWnd::FromHandle(HWND__ * 0x00060aaa) line 293
CWnd::GetOwner(const CWnd * const 0x010b7b2c {CMapPtrToPtr}) line 35 + 22 bytes
AfxGetParentOwner(HWND__ * 0x00050ad2) line 2141 + 7 bytes
CWnd::GetTopLevelParent(const CWnd * const 0x010b7b2c {CMapPtrToPtr}) line 2157 + 6 bytes
CWinThread::PreTranslateMessage(CWinThread * const 0x010b7b2c {CMapPtrToPtr}, tagMSG * 0x004751d0 {msg=0x00000118 wp=0x0000ffff lp=0xa00258ae}) line 680 + 7 bytes
CWinThread::PumpMessage(CWinThread * const 0x010b7b2c {CMapPtrToPtr}) line 848 + 17 bytes
CWinThread::Run(CWinThread * const 0x010b7b2c {CMapPtrToPtr}) line 487 + 7 bytes
CWinApp::Run(CWinApp * const 0x010b7b2c {CMapPtrToPtr}) line 399 + 7 bytes
AfxWinMain(HINSTANCE__ * 0x00400000, HINSTANCE__ * 0x00000000, char * 0x00133476, int 1) line 49 + 7 bytes
WinMain(HINSTANCE__ * 0x00400000, HINSTANCE__ * 0x00000000, char * 0x00133476, int 1) line 30
TCSTATUS! WinMainCRTStartup + 224 bytes
any hint?
Thank you a lot for any help!
|
|
|
|
|
The usuals, check for un-initialized variables, bad conditions in if, bad loops, ...
Give your project a level-4 warning level compile to see if the compiler can find the obvious things.
Maximilien Lincourt
"Never underestimate the bandwidth of a station wagon filled with backup tapes." ("Computer Networks" by Andrew S Tannenbaum )
|
|
|
|
|
See if this helps:
http://flounder.com/debug_release.htm
|
|
|
|
|
Thank you guys.
I used a class for joystick support. I think it's it which couldn't survive the release. I used it in another app, which I couldn't build release version either.
It's using DirectIO tech. Any idea how to debug such stuff?
|
|
|
|
|
lucy wrote:
It's using DirectIO tech. Any idea how to debug such stuff?
Never heard of it. Your best bet is to create a small application that demonstrates the problem. Once the reproducible code is as small as possible, try posting it here for help.
|
|
|
|
|
I am trying to put my own ActiveX on CFileDialog.
When I put on it, all the sudden this CFileDialog
doesn't start up. some can help me to solve this?
Thanks in advanced.
Shinay
|
|
|
|
|
I have an MFC Extension DLL and I load it into memory using LoadLibrary function. Then I call a method of this dll, which creates a modeless dialog.
My problem is I would like to free this dll when the user closes the dialog.
But I am not sure how to do this.
Do I have to unload a dll from the main program or can I unlod the dll from within the dll itself.
If I have to unload it from the main program how can I notify the main program.
Thank you
Orcun Colak
|
|
|
|
|
There are several solutions. One solution is messages. Send a message to the main thread and have it unload the DLL.
Kuphryn
|
|
|
|
|
Be carefull here: if your DLL is proper Extension DLL and you are unloading it from memory: As I recall, MFC doesn't have proper cleanup in this case: pointer to one of your DLL classes may still be registered in main EXE linked list. So, check this out: I just recall having alot of troubles related to this. Maybe MFC has been fixed since then though.
"...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
|
|
|
|
|
Hello all
I'm establising a database connection to sqlserver using ADO. I was able to successfully establish connection to sqlserver and after I'm executing a procedure which returns a recordset. But I'm not able to read from that record set. It was always giving "-1" when I use Recordset.GetRecordCount().
The code I used to perform the connection is as follows
m_Connection->Open((char*)m_ConnectionString, L"", L"", adModeUnknown);
m_Command->ActiveConnection=m_Connection;
m_Command->CommandText = ProcName;
m_Command->CommandType = adCmdStoredProc;
m_Recordset=m_Command->Execute(NULL,NULL,adCmdUnknown);
Now if I use
m_Recordset.GetRecordCount() gives -1;
Is there anything wrong with the above code? Please help me in reading from the recordset.
Thanks for your help
Hari.
|
|
|
|