|
You have to look at shell programming, take a look at it in MSDN.
|
|
|
|
|
make sure u close the File Handle before open next time..
Renjith-The CPian.
|
|
|
|
|
showing us some actual *code* might help.
Christian
I am completely intolerant of stupidity. Stupidity is, of course, anything that doesn't conform to my way of thinking. - Jamie Hale - 29/05/2002
Half the reason people switch away from VB is to find out what actually goes on.. and then like me they find out that they weren't quite as good as they thought - they've been nannied. - Alex, 13 June 2002
|
|
|
|
|
I ran into something similar to this with memory mapped files. It turns out that I had to create the memory mapped file (wrapper) object dynamically even though I saw that the destructor for the object that contained the static file object was executing correctly.
So, I did a "myFileObj = new FileObj;" and a "delete myFileObj" in the destructor and then it actually closed the file. Wierd, huh? But, that was the solution.
|
|
|
|
|
em wrote:
ifsFile.open(ListPath, ios::nocreate);
Get rid of ios::nocreate. You don't need it.
em wrote:
I've set a breakpoint on ifsFile.close();
That's dumb. Set a breakpoint at the start, then you'll find out if the file was good on the way through.
em wrote:
if (ifsFile)
Get rid of this as well.
Christian
I am completely intolerant of stupidity. Stupidity is, of course, anything that doesn't conform to my way of thinking. - Jamie Hale - 29/05/2002
Half the reason people switch away from VB is to find out what actually goes on.. and then like me they find out that they weren't quite as good as they thought - they've been nannied. - Alex, 13 June 2002
|
|
|
|
|
If I use the AppWizard to create an MDI applicaiton. It'll open a document at first. How can i disable the initial document/childview/childframe creation ? I'll create myself in the Menu by using DocTemplate->CreateNewFrame()
|
|
|
|
|
Put this code in your InitInstance()
if (cmdInfo.m_nShellCommand == CCommandLineInfo::FileNew)
cmdInfo.m_nShellCommand = CCommandLineInfo::FileNothing ;
Before the call to ProcessShellCommand()
Roger Allen
Sonork 100.10016
If I had a quote, it would be a very good one.
|
|
|
|
|
网络安全组件让你开发更轻松,省事少力!
网安卫士http://ww.nsguard.com ,本站提供应用层防火墙开发包,文件保护和监视开发包,进程与SOCKET端口关联开发包.....等各类网络用应用和网络安全相关的组件并提供各个开发工具的开发接口,欢迎各位参观,切磋,合作!
邮件 digitalbrain@163.com
icq 1606664478
qq 15614487
|
|
|
|
|
I dunno, but it sure looks cool. I reckon there's more than 26 characters in this post alone, learning to write this language must be a hell of a challenge. Not to mention how big your keyboard must be !!!
With all those words, you'd think they'd have one for socket
Christian
I am completely intolerant of stupidity. Stupidity is, of course, anything that doesn't conform to my way of thinking. - Jamie Hale - 29/05/2002
Half the reason people switch away from VB is to find out what actually goes on.. and then like me they find out that they weren't quite as good as they thought - they've been nannied. - Alex, 13 June 2002
|
|
|
|
|
|
GetTextExtentPoint32 returns the text size in pixels but it is always the clipped to the window extent. I want the total size of the text which doesnot fit completely in the window. Any idea how this can be done?
|
|
|
|
|
Can't you just call CDC::GetTextExtent(text)?
Roger Allen
Sonork 100.10016
If I had a quote, it would be a very good one.
|
|
|
|
|
If I begin a process A from windows and then begin a process B from windows instead of using the CreateProcess() or ShellExecuteEx() functions to spawn process B from process A. How can I get the process B handle to stop process B in process A? Should windows keeps all the process handles have launched for this kind of operation? Thanks.
Kidd
|
|
|
|
|
OpenProcess.
If you only have a process name you first need to look up the PID using some API such as PSAPI. Unfortunately there is no "portable" way to do this within the Win32-family of OS'es, though I think there's some code for it here on CP.
|
|
|
|
|
In addition to what Mike Nordell said, if you know the title text of the main window you might FindWindow() it. Now PostMessage a WM_CLOSE to this HWND. You can use GetWindowThreadProcessId() on the HWND returned to get the thread id and process id of the thread that created the window.
Author of the romantic comedy
Summer Love and Some more Cricket [New Win]
|
|
|
|
|
Well, if you know the process ID, you can use OpenProcess to get a handle. In NT/2000/XP, you can view the PID in the task manager (you might have to tell it to show the PID in the view menu).
|
|
|
|
|
what is the difference of Debug Multithreaded & Debug Multithreaded DLL?
how if I use the Debug Multithreaded DLL when I am making a exe?
thanks
|
|
|
|
|
Debug multithreaded is a static LIB - the CRT code is linked into your EXE. The Debug multithreaded DLL option makes your EXE link with the CRT DLL. This makes your EXE smaller, but you then have to ensure the DLL is on the computers your program will run on.
--Mike--
Just released - RightClick-Encrypt - Adds fast & easy file encryption to Explorer
My really out-of-date homepage
Sonork-100.19012 Acid_Helm
|
|
|
|
|
Additional info. Jeffrey Righter wrote:
When you implement any type of project, you must know which library you're linking your project with. You select a library using the Project Settings dialog box, shown below. On the C/C++ tab, in the Code Generation category, select one of the six options from the Use Run-Time Library combo box.
The first thing you're probably wondering is, "Why do I need one library for single-threaded applications and another library for multithreaded applications?" The reason is that the standard C run-time library was invented around 1970, long before threads were available on any operating system. The inventors of the library didn't consider the problems of using the C run-time library with multithreaded applications.
Consider the standard C run-time global variable errno. Some functions set this variable when an error occurs. Let's say you have the following code fragment:
BOOL fFailure = (system("NOTEPAD.EXE README.TXT") == -1);
if (fFailure) {
switch (errno) {
case E2BIG:
break;
case ENOENT:
break;
case ENOEXEC:
break;
case ENOMEM:
break;
}
}
Now let's say that the thread executing the code above is interrupted after the call to the system function and before the if statement. And imagine that the thread is being interrupted to allow a second thread in the same process to execute and that this new thread will execute another C run-time function that sets the global variable errno. When the CPU is later assigned back to the first thread, the value of errno no longer reflects the proper error code for the call to system in the code above. To solve this problem, each thread requires its own errno variable. In addition, there must be some mechanism that allows a thread to reference its own errno variable but not touch another thread's errno variable.
This is only one example of how the standard C/C++ run-time library was not originally designed for multithreaded applications. The C/C++ run-time library variables and functions that have problems in multithreaded environments include errno, _doserrno, strtok, _wcstok, strerror, _strerror, tmpnam, tmpfile, asctime, _wasctime, gmtime, _ecvt, and _fcvt—to name just a few.
For multithreaded C and C++ programs to work properly, a data structure must be created and associated with each thread that uses C/C++ run-time library functions. Then, when you make C/C++ run-time library calls, those functions must know to look in the calling thread's data block so that no other thread is adversely affected.
You can download Righter's book here:
http://ganz2006.chat.ru/pamw4ejr.rar1
http://ganz2007.chat.ru/pamw4ejr.r00
These is two parts of WinRar archive (rename rar1->rar).
|
|
|
|
|
I need to hilight certain words on HTML Page (from VC through COM). How can I do it? Desirable it seens like in Find Dilog in IE. Or how can I implement behavior of find Dialog (hilight a matching words step by step)?
|
|
|
|
|
Hi! That's my code to start IE and connect to its events:
void CMFCIEEvtSpyDlg::OnStartIE()
{
if (m_pIE == NULL)
{
HRESULT hr = CoCreateInstance(CLSID_InternetExplorer, NULL, CLSCTX_LOCAL_SERVER,
IID_IWebBrowser2, (void**)&m_pIE);
if (SUCCEEDED(hr))
{
BOOL bAdvised = AfxConnectionAdvise(m_pIE, DIID_DWebBrowserEvents2,
m_pIE4Events->GetInterface(&IID_IUnknown),
TRUE, &m_dwCookie);
TRACE("Advise for DWebBrowserEvents2 %s\n", bAdvised ? "succeeded" : "failed");
m_btnStartIE.EnableWindow(FALSE);
m_pIE->put_Visible(VARIANT_TRUE);
CString strURL;
strURL.LoadString(IDS_HOME_PAGE);
COleVariant vtEmpty;
m_pIE->Navigate(strURL.AllocSysString(), &vtEmpty, &vtEmpty, &vtEmpty, &vtEmpty);
}
}
}
In release bild all works correctly, but in Debug function call m_pIE4Events->GetInterface(&IID_IUnknown) failed (returns NULL). I can't understand, why. Here's a source and compilied release (65 K) [new browser window].
Please, help me!! Thanks!
|
|
|
|
|
When running the next program, I get the next error:
"Unspecified error Microsoft cursor Engine Key column information is insufficient or incorrect. Too many rows were affected by update".
A segment of the program is:
_RecordsetPtr pRs;
_ConnectionPtr m_pConn;
CString sErr;
HRESULT hr=0;
CoInitialize(NULL);
hr=m_pConn.CreateInstance(__uuidof(Connection));
m_pConn->Open (_bstr_t("DSN=egadb"), _bstr_t("scott"), _bstr_t("tiger"),
adConnectUnspecified);
_CommandPtr pCommand;
pCommand.CreateInstance (__uuidof (Command));
pCommand->ActiveConnection = m_pConn; // Formerly opened connection pointer
pCommand->CommandText = "select campo16, campo17, campo18, monto from carga";
variant_t vNull;
vNull.vt = VT_ERROR;
vNull.scode = DISP_E_PARAMNOTFOUND;
pRs.CreateInstance (__uuidof (Recordset));
pRs->CursorLocation = adUseClient;
MessageBox("Ahí voy con el recordset");
pRs->Open( (IDispatch *) pCommand, vtMissing, adOpenForwardOnly,
adLockOptimistic, adCmdUnknown);
CString pfldEName, pfldJob, stmp;
BeginWaitCursor();
try {
for (int i=1; i<2; i++) {
stmp.Format("%s", (char *) (_bstr_t)pRs->GetCollect("campo17"));
CString sValAux="";
pRs->PutCollect("campo18", _variant_t(atof(stmp)));
pRs->Update(vNull, vNull);
pRs->MoveNext();
}
pRs->Close();
}
catch (_com_error &e) {
sErr.Format("%08lx %s %s %s", e.Error(), e.ErrorMessage(),
(LPCTSTR) bstrSource, (LPCTSTR) bstrDescription);
MessageBox(sErr);
}
EndWaitCursor();
}
The table to update has more than 600,000 records. May be is it necessary to establish checkpoints?
Thank you in advance for you help!!
|
|
|
|
|
if i have an ATL Dialog inside a dll library, how can i call it from an MFC program, it is a regular MFC DLL?
|
|
|
|
|
|
i just add a new atl object and in miscelaneus choose dialog
|
|
|
|