Problem solved. The CDO is not installed as standard in Outlook 2003! After an update all works fine.
u6ik
Problem solved. The CDO is not installed as standard in Outlook 2003! After an update all works fine.
u6ik
Okay. It looks like the issue is that in Outlook VBA with the CDO library referenced, I get the error 'Activex component can't create object'. The line that fails is: Set CDOSession = CreateObject("MAPI.Session") Any ideas?
u6ik
I've been trying to obtain the email header from messages in Outlook using VBA. I have done some investigation and found that in outlook they are stored separately and require use of the CDO library to get hold of the header. So, I used Tools-Reference to enable the CDO Win 2000 library, cdosys.dll and employed the code below - but on compiling in the Outlook VBA Editor it gives me errors in all references to that CDO library. Can anyone assist here? Many thanks ;) Public Function InternetHeaders() As String Dim objOutlook As Outlook.Application Dim objItem As Outlook.MailItem Dim objCDO As MAPI.Session Dim objMessage As MAPI.Message Dim objFields As MAPI.Fields Dim strID As String Const CdoPR_TRANSPORT_MESSAGE_HEADERS = &H7D001E On Error Resume Next ' Instantiate an Outlook Application object. Set objOutlook = CreateObject("Outlook.Application") 'Find the current email item and get its EntryID Set objItem = objOutlook.ActiveInspector.CurrentItem strID = objItem.EntryID 'Then set up a CDO Session using a piggy-back login Set objCDO = CreateObject("MAPI.Session") objCDO.Logon "", "", False, False 'Now get the item as a CDO Message Set objMessage = objCDO.GetMessage(strID) 'Now get the headers from the message Set objFields = objMessage.Fields InternetHeaders = objFields.Item(CdoPR_TRANSPORT_MESSAGE_HEADERS).Value 'Now that the headers are captured in a string you can do whatever you want with them objCDO.Logoff Set objFields = Nothing Set objMessage = Nothing Set objCDO = Nothing Set objItem = Nothing Set objOutlook = Nothing End Function
u6ik
Yes. A BMP file which can be opened using any BMP viewer. I know how to handle files, but what to put in it, that's the problem. Cheers
u6ik
Dear All. I need to create a Bitmap output file from statistical data without showing to screen. The image will be built in memory and then output to file. I will need to do this in VC++ SDK, not MFC. Can anyone point me in the right direction on this one? (Books / examples / links... etc) I've tried looking around and there are lots of examples of Loading bitmaps and outputting to screen but none on building and outputting from memory. Many thanks ;)
u6ik
Thanks for your replies. All is working peachy :-)
u6ik
I created the box in the resource editor on a Dialog form.
u6ik
I have a problem using a combobox. I am using SDK, not MFC, but basically the combobox updates and I can use the data in it but the drop down functionality of the combobox does not work. I press the arrow at the right of the combobox and nothing happens - I have to use the arrow keys to select the item I want within the combobox data set. Do I have to enable the drop down functionality? Any help would be great :-)
u6ik
Perfect! Many thanks:-D u6ik
I want to allow networked PCs access to my server application. It has various parts and I want to tell the clients PCs where the address of the parts sit (a network address of the server folders). I can do it using a small install program run on each PC individually that inserts the server address of the files in the client PC registry but, is there a elegant way of letting the client PC use a remote program and access the server registry or the files local to the server. Basically, from the client PC, if I run a program on the server can I retrieve data from the server registry rather than the local client registry. Any thoughts? Cheers ;) u6ik
Well, after a bit of digging I found the answer myself. SHChangeNotify(SHCNE_ASSOCCHANGED, SHCNF_IDLIST, NULL, NULL); You need to notify the shell of a change and force a refresh. No need to move the taskbar around yourself, Windows realises there has been a change and corrects the taskbar positioning. All good :-D u6ik
I have written some code to change the screen resolution and depth then return them to their original settings. All works fine, but the Windows taskbar moves occasionally to about midscreen. Is there a function which automatically refreshes the taskbar to the bottom of any reresed window? Or a windows function I can use to move the taskbar to the required bottom edge of the visible screen? Many thanks ;) u6ik -- modified at 7:43 Monday 16th January, 2006
Thanks Gary. I've made the suggested corrections and all works fine now.
token = strtok(dir_name_in, delims);
strcpy(buf, token);
while(token != NULL)
{
if(strlen(buf) > 8)
{
buf[6] = '~';
buf[7] = '1';
buf[8] = '\0';
}
strcat(buf, "\\");
strcat(dir_name_out, buf);
token = strtok(NULL, delims);
}
By copying the token into buf and manipulating that, it doesn't effect the operation of the strtok function. Thanks again :) u6ik
Cheers Dave. Problem solved. Although.. the original problem is a poser. Still, no time to mess around when you're on a deadline ;) Thanks again. u6ik
Can anyone see a problem with this code? It keeps resetting the original string line so it jumps out of the loop after the first token. What it should do is parse the whole line... For some reason it doesn't seem to like the "\\" delimiter, if I use " " is works fine - but " " is not the delimiter I need. Thanks for any help in advance ;) char * token; char dir_name_out[256]; char *delims = "\\"; strcpy(dir_name_out, ""); // Clear output token = strtok(dir_name_in, delims); while(token != NULL) { if(strlen(token) > 8) { token[6] = '~'; token[7] = '1'; token[8] = '\0'; } strcat(token, "\\"); strcat(dir_name_out, token); //strcpy(token, strtok(NULL, "\\\n\0")); token = strtok(NULL, delims); }
u6ik
Excellent... thanks all ;) u6ik
Hi All Could someone kindly let me know how to identify the currently highlighted (tabbed) button on a modeless dialog before it is pressed? I've looked at GetFocus but that seems to only apply to window focus. (Using MFC) Thanks :) u6ik
Cracked it. Simple really... ret = RegSetValueEx(kh2, key_type, 0, REG_SZ, (CONST BYTE *) key, strlen(key) + 1); if(ret != ERROR_SUCCESS) { ret = RegSetValue(kh2, key_type, (CONST BYTE *) key, strlen(key) + 1); }
Just use the older code if the newer code fails. Bit of a faf, but it works. ;P u6ik
I seem to have a compatibility issue with functions accessing the registry. All XP systems work well but 98 and 2K seem to decide they won't play. Its common to all Reg...Ex() functions. Anyone know how to solve this cross Windows issue before I start coding everything in 16bit. Many thanks :-D bool WriteKey(char * key_type, char * key) { bool status = true; // OK LONG ret; HKEY kh1, kh2; DWORD disposition; char *buf1; char *buf2; buf1 = new char[256]; buf2 = new char[256]; // add a key for the new vendor ret = RegCreateKeyEx(HKEY_LOCAL_MACHINE, "SOFTWARE\\KEY1", 0, NULL, REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &kh1, &disposition); // add a key for the new app ret = RegCreateKeyEx(kh1, "KEY2", 0, NULL, REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &kh2, &disposition); if(ret != ERROR_SUCCESS) { MsgBox("WriteKey(): RegCreateKeyEx: Failed."); status = false; } // create sn ret = RegSetValueEx(kh2, key_type, 0, REG_SZ, (CONST BYTE *) key, strlen(key) + 1); if(ret != ERROR_SUCCESS) { MsgBox("WriteKey(): RegSetValueEx: Failed."); status = false; } // close the new key ret = RegCloseKey(kh1); ret = RegCloseKey(kh2); if(ret != ERROR_SUCCESS) { MsgBox("WriteKey(): RegCloseKey: Failed."); status = false; } delete buf1; delete buf2; return status; }
u6ik
Don't know how I missed that, my idiot moment for the day. Many thanks ;) u6ik