|
Hi Stuart,
Thanks for the suggestions.
I tried using the exact way what you have done, but still the same problem occurs. After running this code, if I open my outlook, all the mails will be held in the outbox and will get sent only when I do Send/Receive in outlook window.
Could you please suggest any more ideas on this?
Can you explain how is your original code that doesn't make use of MAPISendMail function, but you are constructing the message in the Exchange Server outbox and send it from there using IMessage::SubmitMessage?
Thanks and regards,
KJ
|
|
|
|
|
The rough procedure is this:
- Open a MAPI session with
MAPILogonEx and get an IMAPISession interface pointer - Open your message store with
IMAPISession::GetMsgStoresTable and then IMAPISession::OpenMsgStore . This gets you an IMsgStore interface pointer. - Open your address book with
IMAPISession::OpenAddressBook . This gets you an IAddrBook interface pointer. - Open your outbox with
IMsgStore::OpenEntry to get an IMAPIFolder pointer on your Outbox. - Create the new message with
IMAPIFolder::CreateMessage . This returns an IMessage interface pointer. - Set the message attributes:
IMessage::ModifyRecipients to add recipients- The message body is either RTF (complex) or plain text (easy). For plain text, set the
PR_BODY_W property of the message - Set the 'Sent Items' folder for the message by setting the message's
PR_SENTMAIL_ENTRYID property - Set the message's subject by setting the
PR_SUBJECT_W property - Set the message type by setting the
PR_MESSAGE_CLASS_W to the correct string (I used "IPM.Note ")
- Send the message with
IMessage::SubmitMessage - Then release all the interface pointers correctly
I wrote wrappers around all the interface pointers to simplify these operations as much as possible - it's still pretty involved, though...
|
|
|
|
|
Hi Stuart Dootson,
I am really new to MAPI functions. I am trying to use the interface functions you suggested, but facing some difficulty in using them. Is it possible to put your source code here so that I can better understand how to use those functions and succeed.
Thanks and regards,
KJ
|
|
|
|
|
Can I suggest you download the Microsoft MFCMAPI[^] sample - that's got pretty much all the code that I mentioned and it's publicly available - I don't think my employers would be too happy if I were to post some of our application code
|
|
|
|
|
Hi,
I have the same issue as you, please tell me if you solve it!
I am having my app freeze when running mapi without outlook.
tkss
|
|
|
|
|
cPtr = (unsigned char *) &Float1 ;
cPtr += 3;
for (k = 0; k<=4; 4; k++)
{
*cPtr = sBuffer [BufPtr++];
cPtr--;
}
What the equivalent of pointer and address in C++ and C#. How to convert above code into C#?
Thanks
|
|
|
|
|
Hi,
pointers are available in C# although you often don't need them.
When used, you will need to turn on the "allow unsafe code" switch of the compiler,
and the "unsafe" keyword, possibly the "fixed" keyword too. I suggest you read up on those
if you can't live without pointers.
|
|
|
|
|
C# workshop?
Of one Essence is the human race
thus has Creation put the base
One Limb impacted is sufficient
For all Others to feel the Mace
(Saadi )
|
|
|
|
|
|
Hello,
I have written irc client. He stays on server because he answers to PING from server. But... when IRC server is reboot'ed or internet connection is disconected client can't see this happen and is inoperative till client is restarted again.
I want make some detection from client side to check if client is still online or IRC server died/client internet connection died.
How to do this simpliest way?
Help,
Regards
|
|
|
|
|
If you don't receive any pings from the server anymore for 5 minutes, it is probably gone.
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
|
|
|
|
|
Yes i was thinking about it but wasnt sure if it is good solution, thanks a lot for answer.
So maybe like this:
DWORD timestamp = GetTickCount();
then in endless loop
if (timestamp < (GetTickCount() - 300000) ){
main(); //restart
}
if (Ping){
answer_pong;
timestamp = GetTickCount();
}
Hope it will work thanks again
|
|
|
|
|
yup it works good ping freq on ircd is 90 sec. so im checking now 110 sec. if client should reconnect.
Im curious how doing it mIRC client because its instant after disconnect from ircd but it isn't known by client ( ircd dont send any message ).
If they use same method as we above, optimally it would be 91 sec. between disconnect and reconnect but its instant.
|
|
|
|
|
Well, if the server (or maybe someone inbetween, like a proxy or such) closes the connection the TCP way (like, the server (the ircd) gets shut down normally), your client will know "rightaway" that the other side is "gone", however, if there is for example a power outage and the server just disappears all of a sudden without a word, your client can't know what happened, it can only guess that since the server doesn't say anything for a while, it's probably gone.
This is probably what happens when there is a split and what you see is that for a while, noone seems to answer you anymore, and after a few minutes you get the flood of people quitting. Something happens between two irc servers and they can't talk to each other anymore, and after a while they consider each other to be gone and generate the split event.
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
|
|
|
|
|
I got it done now exactly like mIRC have.
When we have in endless loop recv (sockets) we should monitor for states <= 0. This means we got disconnected .
Reconnect is instant without depending on PING's now.
Thanks again, regards.
|
|
|
|
|
Normally a CSliderCtrl has its low values at the left/top end and its high values at the right/bottom end. I need a CSliderCtrl that has its low values at the right/bottom end and its high values at the left/top end. I've tried doing MyCSliderCtrl.SetRange(100,0) instead of MyCSliderCtrl.SetRange(0,100) but the thumb gets stuck at the left/top end. Surely there must be an easy way of getting CSliderCtrl to do this, but I can't work out what it is. Does anyone know? --- Thanks, Chris
|
|
|
|
|
Can't you just set the range to be 0 -> 100, and do 100 - (slider value) to get the "reverse" value?
|
|
|
|
|
That's probably impossible because of the internal implementation of the control.
BUT! All you have to do is set the range the normal way, SetRange( 0, 100 ), and then say:
RealValue = 100 - MyCSliderCtrl.GetValue();
|
|
|
|
|
I am writing an application using C++ and MFC. I am trying to prompt the user for the name of a file to save his/her data into. I would expect the following statement to do it:
<br />
CFileDialog dlg( FALSE, TEXT("rte"), m_strPathName,<br />
OFN_OVERWRITEPROMPT | OFN_PATHMUSTEXIST | OFN_HIDEREADONLY );<br />
if ( dlg.DoModal() == IDOK ) {<br />
However, the above statement appears to do nothing. Could somebody please tell me what I am doing wrong or what the best way to debug this is?
Thanks
Bob
modified on Sunday, January 11, 2009 3:17 PM
|
|
|
|
|
Please ignore my last post. The value of the variable m_strPathName had garbage in it.
Bob
|
|
|
|
|
Regards
I have a problem. I cant get to refresh an image the second time it should be displayed. I am using gdi+ function Graphics::DrawImage. The image displays correctly but the second time (in a loop) the function is called the image isn't refreshed. Instead the image stays (on screen) as the first time it was drawn. I know that the image (bitmap) is changed between the two calls for DrawImage function because, when I do something with the window the image is drawn to, (like resizing it, minimizing etc.), the image is refreshed, but if I do nothing the image stays as it is the first time DrawImage draws it. I am changing image's pixels in another function named Render(), that is called before DrawImage.
Is there another function that draws image on screen, or is there a clear screen function. (I tried with graphics.Clear(color) function but after it the screen is filled with the color 'color' and again it it stays like that indefinitely)
The bitmap is created in memory and isn't read from the disk (although it's the same thing once it is in memory).
Here is part of the code which is called continously (in a loop):
void Prikaz(HDC hdc){
Graphics graphics(hdc);
Render();
Bitmap FrameBuffer((BITMAPINFO*) &((*BMPSlika).InfoHeader), (*BMPSlika).PixelData);
graphics.DrawImage(&FrameBuffer,0,0);
}
BMPSlika is a pointer to the bitmap image structure.
|
|
|
|
|
In the underlying Win32 API (the way it was done before GDI+), the client area of a window is painted by a call to BitBlt (or similar function), and then Invalidate, and finally Update.
A similar functionality exists in NET, but it is packaged differently. The Control class (which acts as a container for your image display) implements the Invalidate and Update methods. It's confusing at first glance, but, the Windows graphics system considers rendering a graphic to a window (or control surface) an expensive operation, so the Invalidate method exists so that windows stores the area to be repainted and then, when it recieves the next WM_PAINT message it actually displays the graphic. This is why when you resize or move a window it displays the refreshed image (a Re-size or move generate a WM_PAINT message.) If you call Update() on your control immediately after your drawing code is executed it should immediately display the refreshed image.
|
|
|
|
|
Baltoro wrote: In the underlying Win32 API (the way it was done before GDI+), the client area of a window is painted by a call to BitBlt (or similar function), and then Invalidate, and finally Update.
A similar functionality exists in NET, but it is packaged differently. The Control class (which acts as a container for your image display) implements the Invalidate and Update methods. It's confusing at first glance, but, the Windows graphics system considers rendering a graphic to a window (or control surface) an expensive operation, so the Invalidate method exists so that windows stores the area to be repainted and then, when it recieves the next WM_PAINT message it actually displays the graphic. This is why when you resize or move a window it displays the refreshed image (a Re-size or move generate a WM_PAINT message.) If you call Update() on your control immediately after your drawing code is executed it should immediately display the refreshed image.
what is the function in NET, I use standard windows lib.
i'm using VS 2008, .NET 3.5
modified on Monday, January 12, 2009 12:52 PM
|
|
|
|
|
Valdyr wrote: Bitmap FrameBuffer((BITMAPINFO*) &((*BMPSlika).InfoHeader), (*BMPSlika).PixelData);
That line is suspicious to me....If you can't do it without casting
Bitmap FrameBuffer(&(BMPSlika->InfoHeader), BMPSlika->PixelData);
then something's wrong.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
yes, the BMPSlika is a pointer to another bitmap class. it's not in gdi, i created that structure based on information from this page http://www.fortunecity.com/skyscraper/windows/364/bmpffrmt.html[^] . it does work, and the image is displayed correctly but gdi+ Bitmap class needs another structure as argument (BITMAPINFO) so i needed to cast it.
The image is displayed correctly but it doesn't get refreshed, only when I do something with the window like resizing it, minimizing, (driving it off screen and back)...
this is the wndproc function
LRESULT CALLBACK WndProc(HWND hWnd, UINT message,
WPARAM wParam, LPARAM lParam){
PAINTSTRUCT ps;
HDC hdc;
switch(message){
case WM_PAINT:
hdc = BeginPaint(hWnd, &ps);
Prikaz(hdc);
return 0;
case WM_DESTROY:
PostQuitMessage(0);
SnimiBitmap();
return 0;
default:
return DefWindowProc(hWnd, message, wParam, lParam);
}
}
as Baltoro said the WM_PAINT case is executed only when the window needs an update (when i resize it, minimize...) but it is executed also when I hold a mouse pointer over the window, but then the image doesn't get refreshed... the WM_PAINT case calls for Prikaz() and it is executed every time but when i hold a mouse pointer over the window it is called and executed but then the displayed image doesnt get refreshed...
|
|
|
|