|
I have an application that was originally developed with Windows 98 ( yes, just recently bought new laptop with XP Pro). I have also occationally built the app. on my work PC which runs Windows 2000. No difference there. But when I now try to build with XP all dialogs and CFormViews come out wrong with static texts in shifted positions relative to edit boxes, etc. The environment is VC6.0 service pack 3.
Regards, Haakon S.
A sure cure for seasickness is to sit under a tree.
Spike Milligan
|
|
|
|
|
No need to be . Win98 (?) and Win2000 (great stystem) have a lot in common, but that is where you should have seen problems (if any).
Each system may use a different default character set, which will affect any windows layout that resembles a dialog (that applies to internationalization as well). That means the static text bounding rectangle should be larger than the default size, which is based on the default font size at design time. (You might need to throw in some calculations as well.)
I recommend making a copy of your application and modifing it on XP so that it looks right. Then compare it to the original program (visualy), to see what the difference is. (That may be enough for you to figure out the problem.)
INTP
"The more help VB provides VB programmers, the more miserable your life as a C++ programmer becomes."
Andrew W. Troelsen
|
|
|
|
|
Thanks for the reply!
I found the cause of the problem. It is as simple as DPI (pixels, or dots, per inch). In my program I have used SepMapMode(MM_TEXT). In the dialogs and CFormViews there will be a mix of this mode and DLU (dialog logical units). The former is dependent on the device, the latter is calculated from the font size, which is device independent. Now, that is something to be about. I should of course have used SetMapMode(HI_METRIC), or some such thing.
My new PC has default DPI=120. By changing this to 96 (designated Normal by Windows) my program works fine.
Regards, Haakon S.
A sure cure for seasickness is to sit under a tree.
Spike Milligan
|
|
|
|
|
Check your desktop display "DPI" settings. On some of the machines, you may be set for "small fonts", and on the other, for "large fonts".
Software Zen: delete this;
|
|
|
|
|
Hello Experts!
I am able to retrieve all the profile properties for a user except the PR_MANAGER_NAME property. All of the other fields fetch fine. All the name, address, custom attributes.. you name it, they retrieve fine. The only one that fails is PR_MANAGER_NAME. This fails on all machines tested.
Below is my code (in abbreviated form, that retrieves a single property). You can plug this code into a simple Win32 project (that supports MFC) and it will build and run for you. You will notice about 1/2 way down where I set the property to be read:
//aSenderProps.aulPropTag[0] = 0x3001001E; // PR_DISPLAY_NAME <==== THIS WORKS
aSenderProps.aulPropTag[0] = 0x3A4E001E; // PR_MANAGER_NAME <==== THIS FAILS
Can anyone shed any light on why this is failing? Many thanks in advance!
//======== Code below ====================
// MapiTest.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include "MapiTest.h"
#include <mapix.h>
#include <atlconv.h>
#include <atlbase.h>
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// The one and only application object
CWinApp theApp;
using namespace std;
int _tmain(int argc, TCHAR* argv[], TCHAR* envp[])
{
USES_CONVERSION;
int nRetCode = 0;
// initialize MFC and print and error on failure
if (!AfxWinInit(::GetModuleHandle(NULL), NULL, ::GetCommandLine(), 0))
{
// TODO: change error code to suit your needs
cerr << _T("Fatal Error: MFC initialization failed") << endl;
nRetCode = 1;
}
#define MAPI_INIT_VERSION 0
MAPIINIT_0 mapiInit;
mapiInit.ulVersion = MAPI_INIT_VERSION;
mapiInit.ulFlags = MAPI_MULTITHREAD_NOTIFICATIONS;
CComPtr<imapisession> spMapiSession;
// initialize MAPI
HRESULT hr = ::MAPIInitialize(&mapiInit);
if (!SUCCEEDED(hr))
{
AfxMessageBox("MAPIInitialize error");
}
// logon to the profile
hr = ::MAPILogonEx(0, _T("MS Exchange Settings"), NULL, MAPI_EXTENDED|MAPI_NO_MAIL|MAPI_NEW_SESSION|MAPI_TIMEOUT_SHORT, &spMapiSession);
if (FAILED(hr))
{
AfxMessageBox("Unable to logon");
return 0;
}
CComPtr<imapiprop> spSender;
ULONG uObjectType, uCount, cbSenderEntryIDSize;
LPENTRYID pSenderEntryID=NULL;
LPSPropValue pSenderProps=NULL;
// struct used to hold array of properties to read
struct _SPropTagArray_
{
ULONG cValues;
ULONG aulPropTag[1];
} aSenderProps;
// set the properties to read (in this case, 1 property)
aSenderProps.cValues = 1;
//aSenderProps.aulPropTag[0] = 0x3001001E; // PR_DISPLAY_NAME <= = = = = = = = = = = = == THIS WORKS
aSenderProps.aulPropTag[0] = 0x3A4E001E; // PR_MANAGER_NAME <= = = = = = = = = = = = = THIS FAILS
// Get the Entry Identifier used to read the primary identity
hr = spMapiSession->QueryIdentity(&cbSenderEntryIDSize,&pSenderEntryID);
if (FAILED(hr))
{
AfxMessageBox("Unable to QueryIdentity");
return 0;
}
if (hr == MAPI_W_NO_SERVICE)
{
AfxMessageBox("MAPI_W_NO_SERVICE");
return 0;
}
// OpenEntry
hr = spMapiSession->OpenEntry( cbSenderEntryIDSize,
pSenderEntryID,
NULL,
MAPI_BEST_ACCESS | MAPI_DEFERRED_ERRORS,
&uObjectType,
(LPUNKNOWN FAR *)&spSender);
if (FAILED(hr))
{
AfxMessageBox("Unable to OpenEntry");
return 0;
}
// get the properties
hr = spSender->GetProps( (LPSPropTagArray)&aSenderProps,
0,
&uCount,
&pSenderProps);
if(FAILED(hr))
{
// report, but not fatal
}
CComBSTR bstrTemp;
// display each property found
for (UINT i = 0 ; i < aSenderProps.cValues; i++)
{
if (PROP_TYPE(pSenderProps[i].ulPropTag) != PT_ERROR)
{
// successful read
bstrTemp = pSenderProps[i].Value.lpszA;
AfxMessageBox(CString(bstrTemp));
}
else
{
// unable to read property
bstrTemp = "";
AfxMessageBox("Error: Unable to read property");
}
}
// cleanup
spMapiSession->Logoff(0,0,0);
if (pSenderEntryID)
::MAPIFreeBuffer(pSenderEntryID);
if (pSenderProps)
::MAPIFreeBuffer(pSenderProps);
//MAPIUninitialize();
return nRetCode;
}
// ======== END OF CODE ========================
Mark
|
|
|
|
|
How exactly is failing? Does it return an empty string, is the type set to PT_ERROR, is the return different than S_OK?
--
jlr
http://jlamas.blogspot.com/[^]
|
|
|
|
|
It turns out that I need to read the PR_EMS_AB_MANAGER object. Here is the quote I got from another forum:
You will need to open the PR_EMS_AB_MANAGER property as IMAPITable
(IMailUser::OpenEntry(PR_EMS_AB_MANAGER, &IID_IMAPITable, ...)).
You will get back a table with a single row (or no rows at all).
Read PR_DISPLAY_NAME from that table or grab PR_ENTRYID and call
IAddrBook::OpenEntry to get back IMailUser representing the manager, you can
then read PR_DISPLAY_NAME from that object.
.. now all I need to do is figure out how to do what is described above
|
|
|
|
|
Mark Findlay wrote:
.. now all I need to do is figure out how to do what is described above
I'm sure you will
--
jlr
http://jlamas.blogspot.com/[^]
|
|
|
|
|
Has this ever been resolved?
I need to do the exact same thing and would really like to know how.
|
|
|
|
|
Hi all,
I am working on an aplication where I will need to use a CTreeCtrl. However, I don't want to have the common tree look:
- --Root
|
- --Child1
| |
| - --GrandChild1
| - --GrandChild2
|
+ --Child2
Instead, I would like to use a competition bracket-like style:
- GrandChild1
|
-Child1 --
| |
-Root -- - GrandChild2
|
+Child2
It would be nice if the nodes were represented as shapes with the text inside.
I would like the nodes to have right-click functionality like addchild and delete and
deletechild[i]. I think I can add this functionality myself, but I need help with getting the tree to be laid out in a bracket style and with shaped nodes.
Does anyone happen to have code to do this? or can anyone show me how I would go about doing it?
Thanks a lot
-----------------
Genaro
\\\|
_ _
@ @
_\\
--|
_/
|
|
|
|
|
The tree diagrams do not display like they are supposed to... I guess spaces aren't allowed... if you have questions about either diagram, please ask!
-----------------
Genaro
\\\|
_ _
@ @
_\\
--|
_/
|
|
|
|
|
Please try again using <pre>text here</pre>. Also make sure to preview the message using the preview button to see if it looks alright before submitting it.
Good music: In my rosary[^]
|
|
|
|
|
The normal CTreeCtrl looks like:
- --Parent
|
- --Child1
| |
| - --GrandChild1
| - --GrandChild2
|
+ --Child2
but I would like it to look like another version that looks like:
- Grandchild1
|
- Child1--
| |
| - GrandChild2
|
- Parent--
|
+ Child2
Thanks a lot,
-----------------
Genaro
\\\|
_ _
@ @
_\\
--|
_/
|
|
|
|
|
I have Visual C++ 6 Standard and have tried to integrate the VC++ 2003 Toolkit compiler (ie. VC++ 7.1 Pro optimising compiler) and the Platform SDK with it, but I cannot get it to compile ATL/WTL/MFC projects (I just get a lot of errors). When I switch back to using the "bin" folder from VC++ 6 Std, the projects compile successfully.
Is it possible to do this, or is the VC++ 2003 toolkit compiler hard-coded not to compile ATL/WTL/MFC projects ?
If someone has got it working, I'd appreciate instructions on exactly how to set it up.
|
|
|
|
|
hi,
i need to draw a sin() function that move in the client area ( like the preformance of the CPU in the os' )
the grafh [the sin() func'] must have the ability to chang the frequency
and the amplitude.
h e l p ! ! !
thanks
|
|
|
|
|
Hi there,
Does anybody know a solution how to put a control into the taskbar like ibm does with their battery application?
At this time I'm working on
http://www.codeproject.com/useritems/batteryx.asp
and want to a way how to insert the progressbar into the taskbar.
I found just one solution:
1) get the HWND of the Windows clock (searching for the right class to get the hwnd)
2) create a dialog
3) make it always on top
4) get the rect of the clock
5) and cover it.
But this is not actually what I want. As you can see at the ibm battery. It's places on the left side of the tray notification bar. This means that I've to resize the one bar in which the tasks are placed.
My Question: Does anybody know how to modify the size of one ore more hwnd's in the taskbar. I tried it but it didn't work well.(it crashes)
|
|
|
|
|
i have a CLongBinary Object that contains bitmap i retrieve from Database using CRecordset, how can i Create CBitmap Object from CLongBinary?
|
|
|
|
|
I did not know there was a CLongBinary until just now.
If the memory block, represented by m_hData, is a DIB (device independent bitmap), my CDibData class (article at CP) may be able to load it and convert it to an CBitmap (ahhh, there's a minor flaw in CDibData, I still need to update it) with just that HGLOBAL handle (m_hData).
Any way look at the code for the articles CDibData and CDibSection (I think) to help you figure out what you need to do.
It should be farly simple, like reading data from a file or in this case an array.
INTP
"The more help VB provides VB programmers, the more miserable your life as a C++ programmer becomes."
Andrew W. Troelsen
|
|
|
|
|
Hi,
Is there any way to detect if another program is reading stuff from a control in my software?
Let's say I have a program with a SysListView32 control. If there is another program in my system that reads the entries in that control using windows API calls or AutoIt, is there any way for me to detect it?
thanks
|
|
|
|
|
SHORT ANSWER: NO! (Well none I know of).
LONG ANSWER: YES! I have never done it, but you would have to write your entire program so that each command message would require that it set some internal flag before sending or make the flag (some how) part of the message. This, of course, would mean you could not use MFC or any other frame-work, to design you program.
It gets a lot more complicated from there on.
INTP
"The more help VB provides VB programmers, the more miserable your life as a C++ programmer becomes."
Andrew W. Troelsen
|
|
|
|
|
Hi All,
I'm having a problem with the HeapAlloc and HeapFree functions. I'm using those functions on the default process heap and they seem to work okay upto a particular point. At one point, when a request for a big chunk of memory (~118 MB) was made, the call failed.
A snapshot of the virtual address space showed that the HeapManager never released the memory to the OS, instead, it kept it reserved, committing and decomitting it as necessary. I'm wondering if that was what actually caused the request to fail, maybe the HeapManager wasn't able to find a contiguous region of the requested size?
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
Although not technically correct, you process only has 2GB of virtual address space available to it. If you request 118MB, you have requested 5% of your virtual address space. That is a huge chunk.
Can the problem be that you don't have the contiguous space available? Yes, that can happen. On other VM systems, I have had to change allocation strategies to avoid this problem.
Not knowing if your program is multithreaded or what you allocation requirements are, I can't tell you what you can do. However, using such systems as VirtualAlloc to set aside a permanent block of memory can work. That is how we solved our issues.
Tim Smith
I'm going to patent thought. I have yet to see any prior art.
|
|
|
|
|
There are many object in the same windows,How to let the CListCtrl selected by program othe than by tne mouse?
|
|
|
|
|
i is the item number in the list you want to select
SetItemState(i, LVIS_SELECTED|LVIS_FOCUSED, LVIS_SELECTED|LVIS_FOCUSED);
|
|
|
|
|
|