|
rajeevktripathi wrote:
Now problem is that when i run the program then after 5-10 minutes dialog box(of exe) disappeares automatically.
Your Executable may failing due to one or more reason, try to debug your Executable thats the only way to find solution!
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
|
|
|
|
|
This is a simple question. I have a dialog based application window and i want to resize it before displayed on the screen. I used the PreCreateWindow and the SetWindowPos within OnInitDialog but without success. What i'm doing wrong?
|
|
|
|
|
if you are into OnInitDialog, the dialog is already created and about to be displayed...
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
You have to resize it when it's already created: OnInitDialog is a good place. Try MoveWindow if SetWindowPos doesn't work.
Marc Soleda.
... she said you are the perfect stranger she said baby let's keep it like this... Tunnel of Love, Dire Straits.
|
|
|
|
|
calling the SetWindowPos() at the OnInitDialog should do!.....
can u show us the code?
cheerz....
"faith, hope, love remain, these three.....; but the greatest of these is love" -1 Corinthians 13:13
|
|
|
|
|
I had pass wrong value to the pWndInsertAfter parameter to SetWindowPos . Thans for your time.
|
|
|
|
|
I'm trying to use _strnextc from C Run-Time Library in Visual C++ v6 code, but compiler says is undeclared - I have included the relevant .h file, but looks like something isn't getting #defined to access this function. I am building a statically linked single threaded MFC ptroject.
Can anyone help ?
Thanks,
Grant.
|
|
|
|
|
Hi ,
I am totally new to VC++ .NET environment.
My application is of 3 parts; a static library built in VC++ 6, the application exe - a VC++6 console application and a MFC Extension DLL again from VC6. But all these I have included in VC.NET solution. The static library is used by both the exe as well as the DLL.
I was forced to convert the DLL to Managed Extension as I was using XMLReader.
As i am using a class declared in the static library in the DLL, i get a linking error:
fl_rule_engine error LNK2020: unresolved token (0A00000C) CBinaryField.__dtor
Any help will be much appreciated!!!
This is my first question and I hope I get some answers.
Thanks
smilerays
|
|
|
|
|
Hallo comunity,
where can i download the WebBrowserControl to add them to my dialog to show html files from the web?
I dont have one in my Visual Studio 6!
thanx
mirso
|
|
|
|
|
Isn't it in the ActiveX list already installed (Menu "Project > Add to Project > Components and Control > Registered ActiveX Components")?
Marc Soleda.
... she said you are the perfect stranger she said baby let's keep it like this... Tunnel of Love, Dire Straits.
|
|
|
|
|
Hi,
yes, is true!
thanx
mirso
|
|
|
|
|
Hi,
I want to read data from serial port asynchronously. I developed a program and I am sending the reading part of that program. When I build this code, I have not met any error. But, when I run the program and read data from serial port, my program gives unhandled exception error and I can not see any data on my edit box. Anybody else that helps me about this problem?
Thank you,
Semih
The reading part of my program:
#define MAX_BUFF 128
#define TEN_K 10240
#define STRMAX 1024
HANDLE Open_Com;
HANDLE SPEvent;
DCB dcb;
COMMTIMEOUTS CommTimeouts;
OVERLAPPED overlapped;
CWinThread* pComPort;
CSP_AsyncRead_2Dlg *pWnd = ((CSP_AsyncRead_2Dlg*) pComPort);
UINT ReadPort(LPVOID pComPort)
{
BYTE counter=0;
char sMsg[512];
BOOL fSuccess = 0;
DWORD dwEvtMask = 0;
BYTE tmp[16];
int ReadConstant = 1;
Open_Com = CreateFile("COM3",
GENERIC_READ | GENERIC_WRITE, //access (read and write)
0, // 0: cannot share the com port
NULL, // security (None)
OPEN_EXISTING, // creation : open existing
FILE_ATTRIBUTE_NORMAL, // overlapped I/O
NULL); // no templates file for COM port
if (Open_Com == INVALID_HANDLE_VALUE) //check whether the COM port is opened or not
{
AfxMessageBox("Port Acildi");
} // end if (m_hCom == INVALID_HANDLE_VALUE)
if (Open_Com)
{
memset(&dcb,0,sizeof(dcb));
dcb.DCBlength = sizeof ( DCB ) ;
dcb.BaudRate = 9600;
dcb.ByteSize = 8;
dcb.Parity = NOPARITY;
dcb.StopBits = ONESTOPBIT;
SetCommState(Open_Com, &dcb); // guncel dcb sutructure degerlerini yerlestir
SetupComm(Open_Com, MAX_BUFF, MAX_BUFF); // set input and output buffer sizes
fSuccess = SetCommMask (Open_Com, EV_RXCHAR | EV_RXFLAG); // Set the mask for the events you want to listen for
} // end if (Open_Com)
if(fSuccess)
{
while(Open_Com != INVALID_HANDLE_VALUE)
{
int iBytesRead = 0;
DWORD iBytesReadThisTime = 0;
char szData[MAX_BUFF];
BOOL bRead;
WaitCommEvent(Open_Com, &dwEvtMask, 0);
SetCommMask (Open_Com, EV_RXCHAR);
if (dwEvtMask & EV_RXCHAR){
bRead = ReadFile(Open_Com, &tmp, ReadConstant, &iBytesReadThisTime, 0);
iBytesRead += iBytesReadThisTime;
}
tmp[iBytesRead] = '\0';
if(tmp[0] != '\0'){
try
{
pWnd->m_Vreaddata.SetAt(counter++,*tmp);;//
}
catch(CException* e)
{
AfxMessageBox("Error Occurs!");
e->Delete();
}
} // if(szData[0] != '\0')
}
} //if(fSuccess)
return 0;
}
|
|
|
|
|
Where is your program crashing ? I suggest you to use the debugger and step into the code to see where it crashes. It is also very usefull to see the variables value.
|
|
|
|
|
I always use the debugger to check any errors. In the following, I marked the line where my program is crashing. Please make suggestions that overcome my problem.
#define MAX_BUFF 128
#define TEN_K 10240
#define STRMAX 1024
HANDLE Open_Com;
HANDLE SPEvent;
DCB dcb;
COMMTIMEOUTS CommTimeouts;
OVERLAPPED overlapped;
CWinThread* pComPort;
CSP_AsyncRead_2Dlg *pWnd = ((CSP_AsyncRead_2Dlg*) pComPort);
UINT ReadPort(LPVOID pComPort)
{
BYTE counter=0;
char sMsg[512];
BOOL fSuccess = 0;
DWORD dwEvtMask = 0;
BYTE tmp[16];
int ReadConstant = 1;
Open_Com = CreateFile("COM3",
GENERIC_READ | GENERIC_WRITE, //access (read and write)
0, // 0: cannot share the com port
NULL, // security (None)
OPEN_EXISTING, // creation : open existing
FILE_ATTRIBUTE_NORMAL, // overlapped I/O
NULL); // no templates file for COM port
if (Open_Com == INVALID_HANDLE_VALUE) //check whether the COM port is opened or not
{
AfxMessageBox("Port Acildi");
} // end if (m_hCom == INVALID_HANDLE_VALUE)
if (Open_Com)
{
memset(&dcb,0,sizeof(dcb));
dcb.DCBlength = sizeof ( DCB ) ;
dcb.BaudRate = 9600;
dcb.ByteSize = 8;
dcb.Parity = NOPARITY;
dcb.StopBits = ONESTOPBIT;
SetCommState(Open_Com, &dcb); // guncel dcb sutructure degerlerini yerlestir
SetupComm(Open_Com, MAX_BUFF, MAX_BUFF); // set input and output buffer sizes
fSuccess = SetCommMask (Open_Com, EV_RXCHAR | EV_RXFLAG); // Set the mask for the events you want to listen for
} // end if (Open_Com)
if(fSuccess)
{
while(Open_Com != INVALID_HANDLE_VALUE)
{
int iBytesRead = 0;
DWORD iBytesReadThisTime = 0;
char szData[MAX_BUFF];
BOOL bRead;
WaitCommEvent(Open_Com, &dwEvtMask, 0);
SetCommMask (Open_Com, EV_RXCHAR);
if (dwEvtMask & EV_RXCHAR){
bRead = ReadFile(Open_Com, &tmp, ReadConstant, &iBytesReadThisTime, 0);
iBytesRead += iBytesReadThisTime;
}
tmp[iBytesRead] = '\0';
if(tmp[0] != '\0'){
try
{
pWnd->m_Vreaddata.SetAt(counter++,*tmp);
}
catch(CException* e)
{
AfxMessageBox("Error Occurs!");
e->Delete();
}
} // if(szData[0] != '\0')
}
} //if(fSuccess)
return 0;
}
|
|
|
|
|
|
The variable name of my edit box. Its category is value and its variable type is CString.
|
|
|
|
|
Uuuuhhhh
What's this ???
CWinThread* pComPort;<br />
CSP_AsyncRead_2Dlg *pWnd = ((CSP_AsyncRead_2Dlg*) pComPort);<br />
<br />
...<br />
...<br />
<br />
pWnd->m_Vreaddata.SetAt(counter++,*tmp); <br />
What are you trying to do there ??? You have an unitialized CWinThread pointer that is converted to a CSP_AsyncRead_2Dlg pointer and after that you call a function from this 'pointer'
First, you cannot convert a CWinThread pointer into a CSP_AsyncRead_2Dlg (they are completely different things) and second your pointer points to unitilazed memory (it hasn't been initialized) and so you cannot use it before make it points to a valid object.
|
|
|
|
|
So, how should I change my program? Could you write the correct parts that must be changed in my program?
Gratefully thank you for your help.
|
|
|
|
|
If your CSP_AsyncRead_2Dlg* class is the main window of your program and if you use the MFC, you can use AfxGetMainWindow to retrieve a pointer to the main window (then you'll have to cast it to CSP_AsyncRead_2Dlg*).
I also strongly suggest you to get rid of global variables and global functions, preferably make them members of some class.
|
|
|
|
|
What is the message generated when some one a website is about to be loaded or is loading ?
|
|
|
|
|
Opening page...3 items remaining... downloading...
Js for fun
V
|
|
|
|
|
Anonymous wrote:
website is about to be loaded
If you are using CHTMLView then look for thsi message CHtmlView::OnProgressChange
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
|
|
|
|
|
Use BeforeNavigate2 for a WebBrowser Control.
Marc Soleda.
... she said you are the perfect stranger she said baby let's keep it like this... Tunnel of Love, Dire Straits.
|
|
|
|
|
marcdev wrote:
Use BeforeNavigate2 for a WebBrowser Control.
Sorry for correcting you, May be i am wrong too. BeforeNavigate2 fire When WebBrowser start loading the Webpage !
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
|
|
|
|
|
Ups You're right. I missunderstood the question. Thanks !!
... she said you are the perfect stranger she said baby let's keep it like this... Tunnel of Love, Dire Straits.
|
|
|
|