|
I've tried using CDO's IMessage (in a very simple manner), but for some reason it calls int 3 ... ? ... and just generally dies with a message about an invalid heap pointer deep in the cdo code.
|
|
|
|
|
You can try using SMTP.
Here are some Classes designed to get around problems associated with services : http://www.codeproject.com/internet/csmtpconn.asp
I think there is a newer version at the authors site. They are really easy to use, and work well.
Giles
|
|
|
|
|
thanks, giles, i'll have a look at them
|
|
|
|
|
BTW, there are some classes available through PJ Naughter's site that port Naughter's code from MFC to STL, which saved me a great hassle.
As you said, very easy to use, did the trick fantastically.
|
|
|
|
|
Which ones? That could be very useful.
Thanks,
Giles
|
|
|
|
|
all of the classes from 1.21, I believe, also compiled into a dll that exports a 'quick & easy' PJSendMail() function (perfect for what I needed to do!)
you can download the code at http://naughter.com/download/pj_smtp_stl.zip
|
|
|
|
|
Hello All
I'm attempting to build an SDI application with a splitter window. In the right window, I want to add a propertysheet that contains several propertypages.
I am able to do this just fine in dialog box; however, I can't figure out how to add a propersheet/page directly to the right hand window of an SDI application.
Your help is appreciated.
sam
|
|
|
|
|
Hello everybody,
I am doing an application using C++ that will detect any changes in a directory. Details of any file changes will be notified using the ReadDirectoryChangesW.
Microsoft have a sample code that uses this function which is the fwatch program in the MSDN samples
I tried to reuse some of the codes from fwatch to my current application but it doesn't work. A lot of errors stating comming out from winbase.h and winnt.h file. An error saying that the ReadDirectoryChangesW is not defined also included.
I am now suspecting there is has something to do with the makefile file. Can somebody please explain how and why makefile is created and why there are so many errors in the header files?
Any solution is appreciated
thanks
|
|
|
|
|
|
Hello,
I am having problems with this code working on a windows 98 machine.. I have tested it tons of 95, NT and 2000 machines and I have yet to see any problems... but I have one 98 machine that is unable to create the text file.. here is a sample of my code.. can anyone tell me what I might change to get this to work on the 98 machine...
The code goes out to a Internet url and pulls just the htmls' source and dumps it to a text file so I can open it and parse it later etc...
//Operation that goes to the url and pulls the source
CString CUserProfileDlg::GetFile(const char *url, const Char *filename)
{
char httpbuff[HTTPBUFLEN];
TCHAR szCause[2048];
CString Cause;
Cause.Format("YES");
TRY
{
CInternetSession mysession;
CStdioFile *remotefile = mysession.OpenURL(url,1,INTERNET_FLAG_TRANSFER_BINARY|INTERNET_FLAG_RELOAD);
CFile myfile(filename, CFile::modeCreate|CFile::modeWrite|CFile::typeBinary);
int numbytes;
while (numbytes = remotefile->Read(httpbuff, HTTPBUFLEN))
{
myfile.Write(httpbuff, numbytes);
}
}
CATCH_ALL(error)
{
error->GetErrorMessage(szCause,2046,NULL);
Cause.Format("%s",szCause);
}
END_CATCH_ALL;
return (Cause);
}
//Operation of creating the text file
GetFile(strU+strB+strQ, _T("Source.txt")); //grabing html source
//Open the txt file and read it into a member variable
CFile fileEditText;
if(fileEditText.Open(_T("Source.txt"),CFile::modeRead))
{
//Declare a large buffer for reading the text
char cBuf[1024];
UINT uBytesRead;
//Continue reading until no more data is read
while(uBytesRead =
fileEditText.Read(cBuf, sizeof(cBuf)-1))
{
//Null terminate after the last charcter
cBuf[uBytesRead] = NULL;
//add the buffer to the mapped CString
strTime += CString(cBuf);
}
//Close the file
fileEditText.Close();
//Send the string to the variable
UpdateData(FALSE);
}
After that the file should be created.. I then open it and read it into a variable then parse it for values etc....
Any ideas why this doesn't work just on the 98 machine?
Thanks,
Rob Jones
|
|
|
|
|
Could someone tell me, how do I easily test for previous instances within MFC (for example when I only want to run one instance of my application).
It appears that the CWinApp::m_hPrevInstance variable is always set to NULL so I cannot use that. The MSDN help suggests that I use CWnd::FindWindow() but I can't seem to get that working.
Kind Regards,
Peter Eisfelder
Peter Eisfelder
|
|
|
|
|
http://www.naughter.com/sinstance.html
/ravi
"There is always one more bug..."
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
I want to create a new process, but I don't want to do anything with it. Just fire up an executable and send it on it's way. This is the code I'm using. I'm not leaking memory in any way, right? This is an acceptable way to do it, right? I just want to be sure... Thanks in advance
HANDLE hProcess = NULL;
SHELLEXECUTEINFO shellInfo;
::ZeroMemory(&shellInfo, sizeof(shellInfo));
shellInfo.cbSize = sizeof(shellInfo);
shellInfo.fMask = SEE_MASK_NOCLOSEPROCESS;
shellInfo.lpFile = "executable.exe";
shellInfo.lpParameters = ".\\readme.txt";
if(::ShellExecuteEx(&shellInfo))
{
hProcess = shellInfo.hProcess;
::CloseHandle (hProcess);
}
--
Peace,
Amit Jain
|
|
|
|
|
There is a nice article on CListCtrl located here:
http://www.codeproject.com/listctrl/listctrldemo.asp
When I run the demo, I have the following problems that are just driving me nuts.
1. The top grey bar for each column is 1 line height. Is there any way to make that grey bar 4 lines of height and put more text for the column header??
2. If I pick on the column divider and move it, I lose the column header label. How can I retain the column header?? I can't call InsertColumn again.
3. Is there any way of making a horizontal scrolling for each column, if it needs it? If there is too much text, it just cuts it off and the user can't scroll to see it the rest of the text.
Please, please, any response any one can give me will be greatly appreciated. My email address is brinasas@yahoo.com
Sincerely,
Danielle Jenine
|
|
|
|
|
I'm more or less jumping the gun instead of digging around alittle more, but does any know how to draw on a CTreeView? I have an SDI app and I've put stuff in the OnDraw function, but it never gets called for some reason. I want to be able to draw/paint anything in the window, even if it covers the tree display.
===================
Eric "ArchV" Fowler
Ritual Entertainment
|
|
|
|
|
|
I tried... then it doesn't draw the Tree Control itself. I tried calling the base class CTreeCtrl::OnPaint... didn't work either. And actually, the process of adding the OnPaint function from the classwizard causes the tree not to display, even if I don't change anything.
|
|
|
|
|
If you want to use TreeView's implementation of a WM_PAINT message and add your own, use this:
CMyTreeCtrl::OnPaint()
{
Default();
CClientDC dc(this);
}
Paolo
------
"airplane is cool, but space shuttle is even better" (J. Kaczorowski)
|
|
|
|
|
Hi,
I need to create a word add-in, (just add a new menu and some event handling).
Does anyone know where i can get some samples?
The only MSN article i could find was on using the Word Development Kit, no longer supported or suitable.
Believe it can be done through COM, I Need to support office 97 onwards.
Please Help!
Richard
|
|
|
|
|
|
Hi,
I need to create a word add-in, (just add a new menu and some event handling).
Does anyone know where i can get some samples?
The only MSN article i could find was on using the Word Development Kit, no longer supported or suitable.
Believe it can be done through COM, I Need to support office 97 onwards.
Please Help!
Richard
|
|
|
|
|
Do a search for Comaddin on MSDN and you'll find a basic COMAddin that adds a toolbar and handles some events. Its a great template to use for building addins.
Bret Faller
Odyssey Computing, Inc.
|
|
|
|
|
I have a ATL class with one member function.
If i invoke a thread from the member function passing the 'this' pointer as the CreateThread() parameter the data is invalid when the parameter is casted back inside the thread function.
A test app demonstrating the problem is available on http://www.codeit.dk/christian/threadtest.zip
Like this
// This is my member function which
// is invoked from within my vb test app
STDMETHODIMP Cxx::yy() {
DWORD dwID=0;
// I put some data into a member variable
m_dwFoo = 200873;
::CreateThread(NULL, 0, _TheThread,
(LPVOID)this, 0, &dwID);
return S_OK;
}
static DWORD WINAPI _TheThread(LPVOID lpv)
{
// Cast the lpv pointer back to a class instance
// (the this pointer)
Cxx* p = (Cxx*)lpv;
// Now p->m_dwFoo is corrupted with an invalid value!!
return 0;
}
If I invoke the thread method from within 'OnFinalConstruct()' everything is peachy. It only happens when it is invoked from within a exposed automation method.
The class is declared a free-threaded in the registry.
Any clues?
Christian Skovdal Andersen
|
|
|
|
|
Hiya,
at first - Visual Basic only supports Apartment-model even if "free threaded" is preferred in registry. When you create additional threads in your COM app, care must be taken when calling any methods/events from that threads.
Without looking into sample code, i would guess the apartment instance pointer, your 'this' must be wrapped/marshalled in some way when it was invoked from the STA vb app (in a free threaded app, it would be marshalled for the random RPC thread). This means the interface pointer is a temporary one (limted lifetime and scope) than the CreateInstance()/OnFinalConstruct() one.
When you CreateThread(), the (worker)thread function itself is not guaranteed to execute with the supplied 'this' while the method scope isnt left. When the method scope is left with "return S_OK", the internal COM/RPC invocations are returning too, possibly destroying any temporary (interface) pointers, freeing memory etc.
The case that OnFinalConstruct() works may be an exception, possibly COM-apartment issues. You may compare both 'this' pointers (from OnFinalConstruct() and method invocation).
If you *really* need additional threads in your COM server, then follow the threading rules (marshal interface ptrs or synchronize via postmessage to main STA thread or use static instance 'this'). There exist some MSDN articles regarding asynchronous COM and threading.
Hope this helps,
A. Focht
|
|
|
|
|
I think you must differntiate between interface pointers and 'this' pointers.
If 'this' pointers where to be marshaled it would mean new instances of the objects had to be created.
My bet for the original bug posted is that the last instance to the object is released before the thread function is trying to access the supplied this pointer parameter.
|
|
|
|