|
Thanks,
I'm not much clever, but how about the use of thread here. I found it from one of the article.
And also I found one mistake I've done. Do the SQL connection create and open on that loop. That mean all the time write values to the database, connection is crated and open it. Obviously it is bad.
I appreciate your help all the time...
Eranga
|
|
|
|
|
Hi,
I have some application that i wrote -
I using Visual 2005 to compile it.
When i running it on some machine i getting Error message and i need to install Microsoft Visual C++ Redistributable to run it without Error message.
Do i need to change something in my project setting ? Or compile in some other way ?
What to do ?
Thanks.
|
|
|
|
|
Can you more explain about your program?
|
|
|
|
|
Just ordinary C++ project that i wrote - with some simple UI ( MFC ).
I really don't see any special issues in my project so i don't know what to explain.
|
|
|
|
|
Yanshof wrote: Just ordinary C++ project that i wrote - with some simple UI ( MFC ).
I really don't see any special issues in my project so i don't know what to explain.
Actually the VS2005 changed the way executable is created for MFC Application. now they also required Manifest file for running of executable. so you need the VC++ redist to be installed on installed computer. or if could research more you could embed that manifest file in the executable and you could deploy your project on target computer without needing to install the VC++ redist, but still you may require the dot net 2.0 enviornment.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow Never mind - my own stupidity is the source of every "problem" - Mixture
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
Change your project settings to statically link to the MFC DLL
Judy
|
|
|
|
|
Try that already - its not work.
|
|
|
|
|
Did you rebuild everything after changing the settings? You need to recompile not just relink. You may also need the previous suggestion about a manifest file.
Judy
|
|
|
|
|
I clean all the project and re-build it all again.
Still not work.
|
|
|
|
|
|
AoA
i am new starter for mfc please help me how can i use it.
Abu bakar
|
|
|
|
|
|
i dont know the others, but i can not reach the destiny of the link.
Greetings.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
|
|
|
|
|
I don't know why, but I put the correct link. Anyway search the tread "Study materials for C++/MFC" in thif forum, you may find it.
I've start that tread on 22nd October.
I appreciate your help all the time...
Eranga
|
|
|
|
|
hafiz m abu bakar siddique wrote: i am new starter for mfc please help me how can i use it.
Are you refering any book?
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow Never mind - my own stupidity is the source of every "problem" - Mixture
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
First do you know c++ very well ?
|
|
|
|
|
hafiz m abu bakar siddique wrote: ...how can i use it.
By starting with the basics. On a related note, are you familiar with code development at all?
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
The following is from MSDN...
//
m_pNewViewClass
CRuntimeClass of the new view to create.
m_pCurrentDoc
The existing document to be associated with the new view.
m_pNewDocTemplate
The document template associated with the creation of a new MDI frame window.
m_pLastView
The original view upon which additional views are modeled, as in the creation of a splitter window's views or the creation of a second view on a document.
m_pCurrentFrame
The frame window upon which additional frame windows are modeled, as in the creation of a second frame window on a document.
//
Here m_pNewViewClass and m_pCurrentDoc is easy to understand.m_pNewViewClass specifies the view class to create a new view. And m_pCurrentDoc gives the document which the new view will attach with.
My question is about the other members.
1/ m_pNewDocTemplate -- how to understand its function and role to create a view?
2/ m_pCurrentFrame -- ?
3/ m_pLastView -- ?
In what situation, the members would be used and for what purpose?
From my side, for example I wanna add another view for a document after default view/doc created by m_pDocTemplate->OpenDocumentFile(NULL/strFile) in an MDI app.
//Demo code
CMainFrame::CreateNewView()//
{
CMyHtmlChildFrame* pHtmlChild=new CMyHtmlChildFrame();//use CRuntimeClass* is also OK
CMDIDemoDoc* pDoc=(CMDIDemoDoc*)(MDIGetActive()- >GetActiveDocument());
ASSERT_VALID(pDoc);
CMultiDocTemplate* pTemplate=(CMultiDocTemplate*)(pDoc- >GetDocTemplate());
ASSERT_VALID(pTemplate);
CCreateContext context;
context.m_pCurrentDoc=pDoc;// use existing document
context.m_pCurrentFrame=pHtmlChild;// new child frame to be upon ??
context.m_pNewViewClass=RUNTIME_CLASS(CMyHtmlView);// new view to be created
context.m_pNewDocTemplate=pTemplate;// use existing document Template??
context.m_pLastView=NULL;// no
if (!pHtmlChild- >LoadFrame(IDI_ICON1,WS_OVERLAPPEDWINDOW ¦FWS_ADDTOTITLE,this,&context))
{
TRACE0("Warning: Couldn 't load frame window!\n");
return -1;
}
//pHtmlChild- >ShowWindow(SW_SHOWMAXIMIZED);
pHtmlChild- >InitialUpdateFrame(pDoc,TRUE);
//pTemplate- >InitialUpdateFrame(pHtmlChild,pDoc,TRUE);
//it worked!
return 0;
}
//
context.m_pCurrentFrame=pHtmlChild;
context.m_pNewDocTemplate=pTemplate;
//
here I can't understand its function in spite that I write it out.
Apprecaited for your kind explanation...
Sam
|
|
|
|
|
Anyone can give any help on this question? I think it is about the basic understanding on CCeateContext structure.
Thanks a lot for any help.
Sam
|
|
|
|
|
Hi All,,
I am getting problem while getting bitmap bits from bitmap in Win32 app.And I got my bitmap data using the same thing in MFC in another app.
I used below code in Win32......
<br />
int iWidth = rect.right - rect.left;<br />
int iHeight = rect.bottom - rect.top;<br />
<br />
HBITMAP new_Bitmap = CreateCompatibleBitmap(m_hrootdc,iWidth,iHeight);<br />
HBITMAP temp_Bitmap = (HBITMAP)SelectObject(m_hmemdc,new_Bitmap);<br />
<br />
<br />
BOOL blitok = BitBlt(<br />
m_hmemdc, rect.left - m_bmrect.left , <br />
rect.top - m_bmrect.top ,<br />
rect.right - rect.left,<br />
rect.bottom - rect.top,<br />
m_hrootdc,<br />
rect.left, rect.top,<br />
SRCCOPY);<br />
<br />
int datasize = iWidth*iHeight; <br />
COLORREF* lpClrData = (COLORREF*)LocalAlloc(LPTR, datasize * sizeof(COLORREF));<br />
datasize = GetBitmapBits(temp_Bitmap,datasize * sizeof(COLORREF), lpClrData);<br />
<br />
Here rect is the some rectangle portion,here I got datasize as some no of bytes but in lpClrData buffer I don,t get anythig.
And now I am using the same thing in MFC like bellow.....
<br />
HDC memDC = CreateCompatibleDC(m_hrootdc);<br />
CDC* pScreenDC = CDC::FromHandle(m_hrootdc);<br />
CDC* pMemDC = CDC::FromHandle(memDC);<br />
<br />
int iWidth = rect.right - rect.left;<br />
int iHeight = rect.bottom - rect.top;<br />
<br />
CBitmap newBitmap;<br />
if (!newBitmap.CreateCompatibleBitmap(pScreenDC, iWidth,iHeight))<br />
{<br />
MessageBox(NULL,CString("CreateCompatibleBitmap failed."),CString("Test"),0);<br />
return;<br />
}<br />
<br />
CBitmap* pOldBitmap = pMemDC->SelectObject(&newBitmap);<br />
pMemDC->BitBlt(0, 0, iWidth,iHeight, pScreenDC, 0, 0, SRCCOPY);<br />
<br />
<br />
CBitmap* pbitmap = pMemDC->GetCurrentBitmap();<br />
int datasize = iWidth*iHeight; <br />
COLORREF* lpClrData = (COLORREF*)LocalAlloc(LPTR, datasize * sizeof(COLORREF));<br />
<br />
datasize = pbitmap->GetBitmapBits(datasize * sizeof(COLORREF), lpClrData);<br />
<br />
<br />
Here I got the data very perfactly in buffer.
Is there something missing in my code in Win32.
Plz reply me.
I will Appreciate your answer.
Thanks in advance.
Ashish Bhatt
|
|
|
|
|
From MSDN:
"This function is provided only for compatibility with 16-bit versions of Windows. Applications should use the GetDIBits function."
|
|
|
|
|
But I am doing the same thing in MFC application as I have shown and i got the result then what is the problem here.
Ashish Bhatt
|
|
|
|
|
ashishbhatt wrote: // Capture screen into bitmap
BOOL blitok = BitBlt(
m_hmemdc, rect.left - m_bmrect.left ,
rect.top - m_bmrect.top ,
rect.right - rect.left,
rect.bottom - rect.top,
m_hrootdc,
rect.left, rect.top,
SRCCOPY);
Every thing seems to be fine. But can you tell me or verify what will be position values passed to BitBlt() function like
rect.left - m_bmrect.left , rect.top - m_bmrect.top etc.
|
|
|
|
|
Ya thanks.
here everything comes right somthing like 0,0 position and 1280,1024 position.
I hope problem is not in these value. Plz check the compatibleBitmap() and also SelectObject() function and ma I passing right bitmap handle or not.
Ashish Bhatt
|
|
|
|
|
Ok,So as you told to try GetDIBits(), I used it but I don't get the result.
I modified the original code as below.....
<br />
BYTE* lpClrData = (BYTE*)LocalAlloc(LPTR, datasize * sizeof(BYTE));<br />
<br />
if(GetDIBits(m_hmemdc,new_Bitmap,rect.right - rect.left,<br />
rect.bottom - rect.top,lpClrData,&m_bminfo.bmi,DIB_RGB_COLORS) == 0)<br />
{<br />
MessageBox(NULL,CString("Failed to get Bits from DIB"),CString("TestRTMP"),0);<br />
} <br />
Above function always return zero.So I don't get the ouotput.
Is there any other thing which I am missing in this code plz suggest me.
Thanks.
Ashish Bhatt
|
|
|
|