|
Thank you for your help.
I have found the solution into the project: Dialog Splash Demo.
a .cpp and .h files are provided and it works well.
The files are SplashWnd.cpp and SplashWnd.h.
Regards,
Jean-Michel
|
|
|
|
|
hello! I just learn c++ one week .now i am writing a program and i want to
add *.h written by me to *.cpp.firstly I select FILE-->NEW -->PROJECT-->WIN32 CONSOLE APPLICTION,and i call the projent name on the right ,then select OK,select FILE -->NEW-->FILE-->C++HEAD FILE,then name classfarm.h
-->OK,write the #include<iostream.h>
class farm_house
{....};
then select FILE-->NEW -->FILE -->C++ RESOURCE then select add the file to
the project same as the above on the right.selectOK,then write classfarm.cpp
,but unfortunately debug alway show 1 error o warning, by checking i found the error lies in the included classfarm.h which can not been included to the classfarm.cpp.
please help me ,thank you very much!
vividtang@eyou.com
|
|
|
|
|
I have find the answer ,only write "#include classfarm.h" not "#include<classfarm.h>";P
|
|
|
|
|
Hey,
Is it true that MapAndLoad() maps the .exe or .dll according to FileAlignment and not according to SectionAligment (like the loader does) ?
Thanks in advance!
|
|
|
|
|
Hi,
This is my problem:
I am using VC++ 6.0, and my program has to execute a shell application, this task is accomplished with the "ShellExecute", but my problem starts here.
For example, if the command is indefinite (ping 10.0.0.1 -t), How can I kill this process with a VC++ sentence????? without execute the manual CTRL+C
sorry for my english,
thanks in advance
|
|
|
|
|
Instead use ShellExecuteEx and get Process handle, followed with TerminateProcess....
Brian
|
|
|
|
|
Try to avoid TerminateProcess() if possible. See MSDN description of TerminateProcess for the reasoning. Solutions depend on whether the child process has a top level window or are running in a console. I'll assume the child process you describe will be running in a console.
One way is to...
1. Spawn child process with ShellExecuteEx() or CreateaProcess()
2. WaitForSingleObject(Handle_To_ChildProcessID,YourTimeOutValue)...consider putting this in worker thread
3. If times out, then kill child process
***NOTE: I have read about others getting CreateRemoteThread to work as described below but I personally have not confirmed this. CreateRemoteThread is available in NT/2K/XP. ***
- CreateRemoteThread() using the ProcessID handle you got from CreateProcess and passing the address of ExitProcess() as the lpStartupAddress. ExitProcess() appears to be mapped to the same address in each processes address space. You can obtain this address by using the address from your process.
- When the remote thread starts (and calls ExitProcess) within the child process, the child process can now "cleanly" terminate.
If the child process has a top level window, then just PostMessage(HandleToChildsWnd, WM_CLOSE, 0,0), then confirm the process terminated.
Regards
Mike
|
|
|
|
|
I create a com object using vc++.I want to return two recordsets in one call.The object has a method(Mymethod) like this
#define VS_CONNECT_1 L"Provider=SQLOLEDB;password=Pass;persist Security Info=True;User ID=User;Initial Catalog=pubs;Data Source=sqlserver;"
Mymethod(IDispatch **pRs1,IDispatch **pRs2)
{
AFX_MANAGE_STATE(AfxGetStaticModuleState())
// TODO: Add your implementation code here
_RecordsetPtr pRSMems,pRS1
HRESULT hr;
try {
_bstr_t strSQL;
strSQL = "select * from authors;select * from employee";
hr = pRSMems.CreateInstance (__uuidof(Recordset));
if (FAILED(hr)) _com_raise_error (hr);
pRSMems->CursorLocation = adUseClient;
hr = pRSMems->Open(strSQL, VS_CONNECT_1, adOpenStatic,
adLockBatchOptimistic, adCmdText);
if (FAILED(hr)) _com_raise_error (hr);
pRS1 = pRSMems->Clone(adLockUnspecified);
pRSMems->putref_ActiveConnection(NULL);
*pRs1 = pRSMems.Detach();
long cnt = 0;
pRS1 = pRS1->NextRecordset((VARIANT *)cnt);
pRS1->putref_ActiveConnection(NULL);
*pRs2 = pRS1.Detach();
return S_OK;
} catch (_com_error &e) {
HRESULT hrerr = e.Error();
return hrerr;
}
}
I call it in VB
Dim obj As Object
Dim rst As Recordset
Dim i
Dim rst1 As Recordset
Set obj = CreateObject("mycom.object")
i = obj.mymethod(rst, rst1)
Do While Not rst.EOF
MsgBox rst.Fields(1)
rst.MoveNext
Loop
Do While Not rst1.EOF
MsgBox rst1.Fields(2)
rst1.MoveNext
Loop
I clone a new recordset,then put activeconnection of original recordset to null.But I fails yet.I need help.
thanks.
|
|
|
|
|
Hi,
I have an application that draws text vertically. This application uses the MM_TWIPS mapping mode.
Everything works fine except when I try to copy the text into the clipboard as a metafile. In this case, when the metafile is pasted into MS Word 2002 (XP), the metafile is pasted correctly. However, when the metafile is pasted into MS Word 2000, or into another apps such as Photoshop, the text is rotated by an additional 180º.
For example, if the text rendered in the screen is:
S
A
M
P
L
E
It's converted into
E
L
P
M
A
S
when pasted as a metafile in Office 2000 apps or photoshop.
This does not happen if the mapping mode is MM_TEXT. However, my application is strongly based on MM_TWIPS mode.
This is some sample code:
void CTestView::OnDraw(CDC* pDC)
{
// Set mapping mode
pDC->SetMapMode( MM_TWIPS );
CFont font;
LOGFONT lf;
ZeroMemory( &lf, sizeof(LOGFONT) );
lstrcpy( lf.lfFaceName, "Arial" );
lf.lfEscapement = 900;
font.CreateFontIndirect( &lf );
CFont* pOldFont = pDC->SelectObject(&font);
pDC->TextOut(1100, -1100, "Sample Vertical Text");
pDC->SelectObject(pOldFont);
}
void CTestView::OnEditCopy()
{
CMetaFileDC * m_pMetaDC = new CMetaFileDC();
//draw meta file
CClientDC clientDC(this);
OnPrepareDC(&clientDC);
m_pMetaDC->CreateEnhanced(&clientDC,NULL,NULL,"Metafile");
m_pMetaDC->m_hAttribDC = clientDC.m_hDC;
m_pMetaDC->m_bPrinting = true;
OnDraw(m_pMetaDC);
//close meta file dc and prepare for clipboard;
HENHMETAFILE hMF = m_pMetaDC->CloseEnhanced();
//copy to clipboard
OpenClipboard();
EmptyClipboard();
::SetClipboardData(CF_ENHMETAFILE,hMF);
CloseClipboard();
//DeleteMetaFile(hMF);
delete m_pMetaDC;
}
|
|
|
|
|
Hi,
I am begineer with regard MSMQ technology. I need to know if I can pass a structure via MSMQ and read it on the other side. Any suggestions regarding this will be helpful.
Regards
Arthi.
|
|
|
|
|
You need to convert it to SAFEARRAY type of one dimension.
|
|
|
|
|
Hi !
I suddenly started to have strange warning when compiling my application (which is using Qt). Here is the strange warning I get :
c:\qt\3.2.0\include\qstyle.h(697) : warning C4518: 'int ' : storage-class or type specifier(s) unexpected here; ignored
I don't know exactly why and when I started to get this warning, but I don't understand it, because I include 'qstyle.h' only once, and the line pointed by the compiler is :
static QRect visualRect( const QRect &logical, const QWidget *w );
which doesn't contain any 'int' !
I don't know if it's the reason of the problem, but I tried to centralised all the Qt includes in one single header file. I tried to move the #include <qstyle.h> line, to make it the first or last line, but it doesn't change anything to the problem.
Any idea ?
Thanks !
Jerome
|
|
|
|
|
The actual error is often on the line before the one flagged by the compiler. The syntax error messes up the parsing, but not enough to generate an illegal parse tree. Then the next line comes along, but the compiler's still in the half-whacked state, and finally realizes there's something wrong. So it flags line 697 but the error is really on the preceding line.
--Mike--
Ericahist | CP SearchBar v2.0.2 | Homepage | RightClick-Encrypt | 1ClickPicGrabber
Pinky, are you pondering what I'm pondering?
I think so Brain, but if we shaved our heads, we'd look like weasels!
|
|
|
|
|
Thanks, but I still don't understand. The thing is that this warning appears in a header file which I didn't wrote myself. I just include it and get this warning.
Any idea on how to fix it ?
Jerome
|
|
|
|
|
May be that src needs some project settings to be set, check out the project settings where it is used originally.
The World is getting smaller and so are the people.
|
|
|
|
|
Looking for info on how to do column
based selection in a richeditctrl.
Any links or code would be great.
Thank You
Bo Hunter
|
|
|
|
|
Hi all,
can anyone tell me what is the maximum number of bytes and characters i can store using a CString variable..I need to store huge data something in MB's in some string type variable and it fails..is there any way to store any size of characters or any no of bytes in a cstring by customizing it..Please help me..I need it urgently?? Hope this is not a big problem for most of u out there??
Thanks a lot in advance..
Regards,
Himanshu
|
|
|
|
|
xxhimanshu wrote:
store huge data something in MB's in some string type variable and it fails
Fails how? CString uses the heap so the theoretical limit on the string size is 2GB or your total available virtual memory.
--Mike--
Ericahist | CP SearchBar v2.0.2 | Homepage | RightClick-Encrypt | 1ClickPicGrabber
Actual sign at the laundromat I go to: "No tinting or dying."
|
|
|
|
|
Hi,
Thanks for your message. I am just trying to store a encoded XMl file data into the string..so that I do not need to decode it any time..and make it physically available to the user..hence I need to store the data into a string. But after a limit it stops appending the data to the string, I hope there cannot be any NULL into a XML file. When i try to decode it, the file is decoded successfully and hence it is in proper XML format..but when i try to store the same data into string it just stops at a point..here is the piece of code i am using..
CString S;
CString XML;
XML=S;
CFile inFile;
BYTE con[65535];
CFile outFile;
if(!inFile.Open(inFilePath,CFile::modeRead|CFile::shareDenyNone)) return "Error";
if(!outFile.Open(outFilePath,CFile::modeCreate|CFile::modeWrite)) return false;
CArchive ar(&inFile,CArchive::load);
BYTE Result[57+1];
while(ar.ReadString(S)) {
char Len=Decode(Result,S);
XML+=Result;
// MessageBox(NULL,XML,"XML",MB_OK);
outFile.Write(Result, Len);
}
return XML;
Please help..Thanks a lot in advance..My data in XML is around 1 MB..the file size id 1.2 MB nearly..
Regards
Himanshu
|
|
|
|
|
I have Visual C++ 6.0 and would like to port my app to the Pocket PC. Which studio/compiler do I need for this?
|
|
|
|
|
|
I finally found it and installed it. Have you installed the embedded visual tools yourself? I can not get it to run under Windows XP Pro getting the error message: failed to connect the drop-in CPU database. Do you have any idea what this is refering to?
|
|
|
|
|
I have to Map the objects with combined key which forms unique keys.
How can i use CMap with 2 compined key??
I thought of placing those 2 keys as structure and using it.
If i use structure or class as a key , Will the efficiency will be better than comparing say searching of those values in CArray.
How CMap will behave in this case??. I guess the CMap will not be much better in this case. If i lookup for the key , they should also search interally & find the values.Correct me if am wrong.
Let me know, Is there any other way to Map the object with multiple ent key?
For eg:
typedef struct {
int no;
CString Name;
}Key;
CMap<key,key,cstring,cstring> m_myMap;
Thanks & regards,
Uma
|
|
|
|
|
CMap is ok, STL is better....
CMap uses hashbuckets, efficency based on size of the data, hash alg, etc etc etc..
Multiple keys can be achived by multiple maps with <keyx, pointer="" to="" the="" object="">. You can reduce initialize penalty, by initializing maps as needed..
Brian
|
|
|
|
|
hi,
i need to display the printer status. whether it is connected or switched on or not. there is any api call or mfc call for this. share with me. any one help to me.
thanks in advance.
Murali.M
|
|
|
|
|