|
Sorry. There is no egistry key from where you can get the list of all the unsuccessful or broken installations.
Ovidiu Cucu
Microsoft MVP - Visual C++
|
|
|
|
|
Hi,
I have developed a MFC ActiveX control and embeded it in IE. The control is working fine but when another instance of IE is opened using Ctrl+N, I am getting ASSERT exception in debug mode and in Release mode IE crashes.
Note that if the second instance is opened without using Ctrl+N (i.e by using explorer icon) no exception arrises.
what could be wrong. your support is highly appreciated.
Thanks
Muhammad Azam
|
|
|
|
|
Hi,
In my application i need to generate an html page on-the-fly. The page is preseneted in the application's internal (iexplorer 6.0) browser.
Of course, i can generate a text file with all the html tags and all that is required, but i'm sure there's a more elegent way of doing so.
I couldn't find any on the web.
Does anybody have a lead?
Cheers in advance.
Snir Yarom
Singleton Technonlogies Ltd.
|
|
|
|
|
You can set the text directly to the brwser document right? I think most of the Dlls (e.g Team Track) generating HTML pages are doing in same way. Anyway for that purpose, you dont need to write to a file. Only need to keep that buffer generated.
SaRath.
"It is your attitude, not your aptitude, that determines your altitude - Zig Ziglar."
My Blog | Understanding State Pattern in C++
|
|
|
|
|
Sarath is saying right. You do not have to generate a file. there is simple way.
You can get the interface IWebBrowser2 of the IE.
from that get the interface IHtmlDocument2 of the IWebBrowser2.
call the function write of the above interface.
IHtmlDocument2::write( "text" )
But this code will work onlt in COM
|
|
|
|
|
Hi,
An elegent way could be, have your data in xml format, write an xsl file that will transform your data from xml to html and display that html in webbrowser
Your can search for IDOMDocument interface for transformation of xml through xsl into html .
hope this satisfies you
Thanks
|
|
|
|
|
Hi all,
I have strange error during serialization. I do the following:
ar << m_nTime; // (Value typically > 120000)
ar << m_bFlag; // (type BOOL)
and the m_bFlag always returns as 0;
If I do the following:
ar << m_nTime;
int tmp;
tmp = m_bFlag ? 1 : 0;
ar << tmp;
everything works fine.
I'm certainly a little confused and if anyone has some ideas that would be great.
Thanks
Tom
|
|
|
|
|
_Tom_ wrote: ar << m_nTime;
int tmp;
tmp = m_bFlag ? 1 : 0;
ar << tmp;
it seems that you are trying to do this...
int tmp;
tmp = m_nTime ? 1 : 0;
ar << tmp;</blockquote>
Im not sure whether i've answered you.
if you explain, what you are trying to do will be more useful.
SaRath.
"It is your attitude, not your aptitude, that determines your altitude - Zig Ziglar."
My Blog | Understanding State Pattern in C++
-- modified at 6:59 Wednesday 28th June, 2006
|
|
|
|
|
I don't think BOOL is one of the data types supported by CArchive. I usually treat my BOOL types as a flag in a BYTE or DWORD when serializing or something to that effect.
|
|
|
|
|
Much scraping for nothing.
BOOL is a type defined in WINDEF.H
typedef int BOOL;
and CArchive has an operator
CArchive& operator <<(int i);
Ovidiu Cucu
Microsoft MVP - Visual C++
|
|
|
|
|
Fair enough. I stand corrected.
I guess because it wasn't in the MSDN list for CArchive, so I just assumed...
Anyway, to save face, Serializing a BOOL (int) will take up 4 bytes in the file which can get excessive if there are many BOOL's in many objects. Storing as many of these as flags in BYTE's or DWORD's will prevent waste.
Good day and thanks for the correction.
|
|
|
|
|
Sincerely, me personal, I wolud like to prefer wasting few bytes than wasting time and adding extra code.
Although, that's not so big subject to argue...
Have a nice day!
Ovidiu
|
|
|
|
|
After reading the API for PeekMessage, this only works with the message queue of the current thread. I have tried using this function in another thread, and passing the HWND of the MainApp´s window and this does not work. (If I have understood the MSDN correctly, this is the correct behavour). Is it possible to peek into the message queue of another thread?. For example
UINT ThreadProc(LPVOID pVoid){
MSG msg;
struct_t* pS = reinterpret_cast<struct_t*>(pVoid);
HANDLE hEvent = CreateEvent(NULL, TRUE, FALSE, _T("NAMED_EVENT");
ASSERT(NULL != hEvent);
if(NULL == hEvent){
return 1;
}
DWORD dwWait = 0;
BOOL bContinue = TRUE;
while(bContinue){
dwWait = WaitForSingleObject(hEvent, 1000);
switch(dwWait){
case WAIT_TIMEOUT:
while(::PeekMessage(&msg, pS->hWnd, NULL, NULL, PM_NOREMOVE)){
bContinue = pS->pThread->PumpMessage();
}
break;
case WAIT_OBJECT_0:
bContinue = FALSE;
break;
}
}
return 0;
}
struct_t is just an example of what I am passing. The HWND of the main application window, and pThread the CWinThread of the main application.
Any suggestions would be appriciated...
Thanks
bum... and I thought I´d got rid of all the bugs
|
|
|
|
|
TRY ATTACHING THE HWND TO A CWnd object.
so you can get the message queue.
CWnd wnd;
wnd.Attach(hwnd);
......
wnd.Detach();
SaRath.
"It is your attitude, not your aptitude, that determines your altitude - Zig Ziglar."
My Blog | Understanding State Pattern in C++
|
|
|
|
|
No, I have tried that and it does not work. The PeekMessage (I think) is still looking in the current threads message queue (i.e. the worker thread). This is not the result I need.
I have tried also the following:
BOOL CMainFrame::FudgeForceRedrawOfMainWindow(){
MSG msg;
while (::PeekMessage(&msg, NULL, // pump message until none
NULL, NULL, PM_NOREMOVE)) // are left in the queue
{
AfxGetThread()->PumpMessage();
}
return TRUE;
}
A function to see if there are any messages pending in the App´s message queue
BOOL CMainFrame::IsMessageQueueEmpty(){
// QS_ALLINPUT
// ***********
DWORD dwState = GetQueueStatus(QS_ALLINPUT);
if(HIWORD(dwState) == QS_ALLEVENTS){
return FALSE;
}
// Nothing of interest
// ******************
return TRUE;
}
Calling this function in my worker thread instead of ::PeekMessage(....) i.e. in the ThreadProc
Changed the structure passed to include a CMainFrame pointer pxFrame
...
case WAIT_TIMEOUT:
while(!pxFrame->IsMessageQueueEmpty()){
pxFrame->FudgeForceRedrawOfMainWindow();
}
break;
...
When called from the tread, the FudgeForceRedrawOfMainWindow() function never has any messages in the queue (in the PeekMessage(...) and therefore the PumpMessage() is never called.
HOWEVER if I call the FudgeForceRedrawOfMainWindow()in the same thread as the MainApp ( in lengthy interations) it works fine!
I´m a bit stumped about this....
bum... and I thought I´d got rid of all the bugs
|
|
|
|
|
Exactly what are you trying to do and what is the problem? You could always post a message from your worker thread to your main window (which is owned by your main thread) and do your strange IsMessageQueueEmpty() and FudgeForceRedrawOfMainWindow() thing there, but even without knowing the problem, I think your solution is questionable.
Edit: I was thinking about it, and i only managed to think up one classic mistake in which this would be necessary. Immediately after creating a worker thread, you wait for the worker thread to finish in the main thread which of course means that the main thread is unable to handle messages.
-- modified at 8:50 Wednesday 28th June, 2006
|
|
|
|
|
My Problem is that I have to use CDAO* MFC classes for an application nad they are not multithreaded. Using another library / collection is not an option (boo hoo!). Opening tables and querys using the dereived tables takes (sometimes) ages. During this time, the UI does not process the normal messages (WM_DRAW etc). To get around this, I am trying to create a worker thread that will "Force" the Main window (CMainFrame) to update it´self. Some functions within the CMainFrame have an iterationary style, therefore I can call my "FudgeForceRedrawOfMainWindow()" every n steps in the iteration. Unfortuntly, the DB functions are not, for example CDaoDatabase.Execute(...); That is why I am trying to call the "FudgeForceRedrawOfMainWindow()" from a worker thread, i.e. create the worker thread before calling the function (CDaoDatabase.Execute(...)) and then closing the thread once the function returns.
Trying to post a message from the worker thread to the main thread (Registerd windows message WM_USER+n) does not work as they are not processed. Until AFTER the CDao* function returns.
Hope this answers your question, and that is why I cannot do it any other way, and why I have posted my problem here...
Phil
bum... and I thought I´d got rid of all the bugs
|
|
|
|
|
You can't get your main thread to redraw as it has to wait for CDaoDatabase.Execute(...) to return.
You got the idea upside down. The worker thread is the one that should perform your lengthy processing ie. CDaoDatabase.Execute(...) should be in the worker thread and not the other way around. If you only wish to have one query execute at a time you can always disable the main window (and maybe pop up a progress bar window - one of those in which the progress just bounces left and right) before you start the thread. And re-enable the window (and kill the progress bar window) when the worker thread posts a message to the main thread that the execution has completed.
-- modified at 9:03 Wednesday 28th June, 2006
|
|
|
|
|
Yes I agree totally, that is how I would like to do it, but the MFC CDao classes do not allow the use with multiple threads and changing the library is not an option (even to the standard CDatabase, CRecord would be enough) As I am "only" "maintaining" this application. Only the main thread (CWinApp) can have access. It was just a thought...
Thanks anyway
Phil
bum... and I thought I´d got rid of all the bugs
|
|
|
|
|
Did you call AfxDaoInit()/AfxDaoTerm() in the worker thread?
|
|
|
|
|
Of course, the problem is in the non existent multi-threading capabilities of the MCF DAO library. I´ll have to live with what I have and wait until I have the time to re-implement the whole DB access of the application (perhaps ADO, have to play around with that before I decide) Until then...
Thanks for the time and help you have given...
mfg
Phil
bum... and I thought I´d got rid of all the bugs
|
|
|
|
|
Hi this is my first post in this forum. I am having problem with a portion of codes in C++. Hope you guys can help me solve this matter. Sorry if it's too long and also my terrible English. Thank you all in advance.
I have a function ValidateInvCtnReturn() which process the invoice inputted by user and return AE. The function is retriving few data from inv_lot table which are invoiceNo, cartonNo, ReturnStatus and few more.
Depending on the input, there are 4 posibilites of AE being returned which are:
- AE_NOINVOICE => The invoice is not found in the database
- AE_DUPLICATERC => The invoice has a RC status in ReturnStatus field
- AE_DUPLICATERA => The invoice has a RA status in ReturnStatus field
- AE_NOERROR => The invoice has passed all the checkings and no error
I have tried several attempts on retrieving the table.
___________________________________________________________
1. Input a non-existing invoice, existing invoice with RC status, existing invoice with RA status
Result: As expected, program returns AE_NOINVOICE, AE_DUPLICATERC, AE_DUPLICATERA in order successfuly.
2. Input an existing invoice with no returnstatus (returnStatus field is NULL in database)
Result: I am expecting the program to prompt me the "SUCCESS" message. Instead it prompts database error, which is a default error message whenever there is a problem with the database.
Following is the code calling ValidateInvCtnReturn() function:
if(ValidateInvCtnReturn(invoiceStr)!=AE_NOERROR){
DisplayMessage("No error");
}else{
DisplayMessage("SUCCESS");
}
//The ValidateInvCtnReturn() function
int ValidateInvCtnReturn(const char* invoiceNo)
{
//DisplayStatus("Validate Invoice");
char sourceStr[SRC_LEN+1];
int ae = AE_NOERROR;
HRESULT hr = S_OK;
ADODB::_RecordsetPtr Rs = NULL;
ostrstream osSrc(sourceStr,sizeof(sourceStr));
osSrc << "SELECT InvoiceNo, cartonNo, ReturnStatus FROM inv_lot "
<< "WHERE InvoiceNo='" << invoiceNo << "' AND "
//<< "CartonNo ='" << CartonNo << "' AND "
<< "DivCode='" << gDC << "' AND "
<< "FactCode='" << gFC << "'"
<< ends;
_bstr_t Connect( gConnectStr );
_bstr_t Source ( sourceStr );
try{
TESTHR(hr = Rs.CreateInstance( __uuidof( ADODB::Recordset )));
Rs->Open( Source, Connect, ADODB::adOpenForwardOnly, ADODB::adLockReadOnly, ADODB::adCmdText);
if (Rs->BOF){ // no records returned
DisplayMessage(GetAppError(ae = AE_NOINVOICE));
// ae = AE_NOINVOICE;
// DisplayMessage("No Invoice");
}
else if (stricmp(((char*)(_bstr_t)Rs->Fields->Item["ReturnStatus"]->Value),"RC") ==0){
DisplayMessage(GetAppError(ae = AE_DUPLICATERC));
// ae = AE_DUPLICATERC;
// DisplayMessage("Duplicate RC");
}
else if (stricmp(((char*)(_bstr_t)Rs->Fields->Item["ReturnStatus"]->Value),"RA") ==0){
DisplayMessage(GetAppError(ae = AE_DUPLICATERA));
// ae = AE_DUPLICATERA;
// DisplayMessage("Duplicate RA");
}
else if ((Rs->Fields->Item["ReturnStatus"]->Value.vt == VT_NULL) ==0){
DisplayMessage(GetAppError(ae = AE_NOERROR));
ae = AE_NOERROR;
DisplayMessage("NULLY");
}
Rs->Close();
Rs = NULL;
}
catch (_com_error &e )
{
ae=AE_DBERROR;
DisplayComError(e);
}
return ae;
}
|
|
|
|
|
alpha error LNK2019: riferimento al simbolo esterno "struct Gradient __cdecl gradient(double (* const)[3][3],double)" (?gradient@@YA?AUGradient@@QAY122NN@Z) non risolto nella funzione "void __cdecl Mogi(class ambient &,class source &)" (?Mogi@@YAXAAVambient@@AAVsource@@@Z)
alpha error LNK2019: riferimento al simbolo esterno "void __cdecl bound_x(double,double (* const)[3],double)" (?bound_x@@YAXNQAY02NN@Z) non risolto nella funzione "void __cdecl Mogi(class ambient &,class source &)" (?Mogi@@YAXAAVambient@@AAVsource@@@Z)
alpha error LNK2019: riferimento al simbolo esterno "void __cdecl bound_y(double,double (* const)[3],double)" (?bound_y@@YAXNQAY02NN@Z) non risolto nella funzione "void __cdecl Mogi(class ambient &,class source &)" (?Mogi@@YAXAAVambient@@AAVsource@@@Z)
alpha fatal error LNK1120: 3 esterni non risolti
Any idea ?
|
|
|
|
|
may be you are not linking to the directory whose fucntions you are calling. YOu need to mention the name of the library in the Additional Dependencies option.
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
Did you include the cpp files in which these functions or structs are defined (or the library) ?
BTW, it would be nice that you translate the error messages in english.
Cédric Moonen
Software developer
Charting control
|
|
|
|