|
You seem on the right track and I've done this in the past. Looking back at my code I see that in my code I wrote a description of what I was trying to do which I'll put below to save rewriting in the hope that the explanation may help you.I haven't put my whole function below, I've left out the part that finds the size of the new bitmap from the size of the old but maybe the part I've put will help.
The diagram is a bit out due to tabbing size but looked fine in Visual Studio and I'm sure you an get the idea.
HRESULT ClassName::GetRotatedBitmapNT(const CBitmap* pcbmBitmap, CBitmap* &pcbmRotated, float radians )
{
and the code:
HBITMAP hbmOldSource = (HBITMAP)::SelectObject( hSourceDC, hBitmap );
HBITMAP hbmOldDest = (HBITMAP)::SelectObject( hDestDC, hbmResult );
HBRUSH hbrBack = CreateSolidBrush( clrBack );
HBRUSH hbrOld = (HBRUSH)::SelectObject( hDestDC, hbrBack );
PatBlt(hDestDC, 0, 0, (int)newwidth, (int)newheight, PATCOPY );
::DeleteObject( ::SelectObject( hDestDC, hbrOld ) );
BOOL bRet;
POINT OldSourceOrg;
POINT OldDestOrg;
bRet = OffsetWindowOrgEx(hDestDC,(int)xmin, (int)ymin, &OldDestOrg);
float C = (float)cos(radians);
float S = (float)sin(radians);
float T11 = C;
float T12 = S;
float T13 = 0;
float T21 = -S;
float T22 = C;
float T23 = 0;
SetGraphicsMode(hDestDC, GM_ADVANCED);
XFORM xform;
xform.eM11 = T11;
xform.eM12 = T12;
xform.eM21 = T21;
xform.eM22 = T22;
xform.eDx = T13;
xform.eDy = T23;
SetWorldTransform( hDestDC, &xform );
BitBlt(hDestDC,0,0,bm.bmWidth, bm.bmHeight, hSourceDC, 0, 0, SRCCOPY );
bRet = OffsetWindowOrgEx(hSourceDC,OldSourceOrg.x, OldSourceOrg.y, NULL);
::SelectObject( hSourceDC, hbmOldSource );
::SelectObject( hDestDC, hbmOldDest );
pcbmRotated = new CBitmap();
pcbmRotated->Attach(hbmResult);
SetCursor(OldCursor);
return S_OK;
|
|
|
|
|
5 for the diagram. That's above and beyond the call of duty. Steve
|
|
|
|
|
Thanks Jonathan, it helped me to understand the usage of worldtransform clearly and I can see the difference in the way I am trying to use vs the way you described and your way is working flawlessly. PKNT
|
|
|
|
|
|
Hi all,
We know that Windows "Open With" dialog box shows a complete list of installed applications that can open a file of some format. I want the same list of applications.
I could not find anyway by which I could use and customize the "Open With" dialog box of Windows. But please note that I don't want the list of every executable that is shown by "Add/Remove Program".
Is there a way to get the list of applications that can open file of some format (as shown by "Open With" dialog box of windows.)?
I can code in both C++ and C# but preferably C#.
Thanks and Regards
Aseem
|
|
|
|
|
|
Have a think about file associations, and then where windows stores information.
I bet you could work it out for yourself in a few minutes. Morality is indistinguishable from social proscription
|
|
|
|
|
Aseem Sharma wrote: We know that Windows "Open With" dialog box shows a complete list of installed applications that can open a file of some format. I want the same list of applications.
Try the HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts registry key."One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Man who follows car will be exhausted." - Confucius
|
|
|
|
|
Hi,
Please let me know ;
Is subclass and drived class are same?
|
|
|
|
|
|
ok then what is difference between subclass and ownerdarw
|
|
|
|
|
maybe a precision, subclassing was mostly used in Win32 to help ownerdraw a control, but with MFC you can either subclass a control or derive from a control.
you csn subclass a control without having the need to ownerdraw it (for example change the behaviour without changing the look).
(I'm probably wrong, but ...) You need to subclass (or derive) to be able to Ownerdraw a control.
M.Watched code never compiles.
|
|
|
|
|
To subclass a window means to add the ability to intercept windows messages for a standard window or control and add some custom behaviour to it. Ownerdrawing is a facility provided by certain controls where the control itself calls back to a user function which performs the actual paint functionality. txtspeak is the realm of 9 year old children, not developers. Christian Graus
|
|
|
|
|
|
how to Arrange/sort rectangle control buttons according to size or name in a dialog based application please help me I have 10 buttons created dynamically in a dailog with different sizes.how to arrange them according to the sizes and according to name.When application is running
It is needed to create buttons dynamically.
-- Modified Friday, February 19, 2010 5:58 AM
|
|
|
|
|
Do you really need to create controls dynamically?!
However, take a look at MoveWindow()[^], SetWindowPos()[^], etc., to move your controls at runtime.
“Follow your bliss.” – Joseph Campbell
|
|
|
|
|
Hi All,
I have developed one Add ons for Internet explorer. Now I want to add Publisher name for add ones. When you will click on Tools->manage Add ons on IE, You will see list of publisher name like Google , yahoo for there ad ons.I want to add such publisher name for add ons.Is it related to code signing of application? plz send me some hint....
Thanks
abm
|
|
|
|
|
|
Hi all,
i sending sms from my mobile with the help of At commands.
its working fine.
i have one problem,firstly i m sending normal sms from application,than i m using AT+CSMP command to send flash sms from mobile.
when i again start the application and start to send sms, all message are set in flash format.
i dont know can i send sms again in normal message again.
please help me how can i remove flash sms format here,
thanks in advance.
|
|
|
|
|
This is what my documentation says for this command:
3.3.2 Set Text Mode Parameters +CSMP
Parameter Command Syntax
Command Possible response(s)
+CSMP=[<fo>[,<vp>[,<pid>[,<dcs>]]]]
+CSMP? +CSMP: <fo>,<vp>,<pid>,<dcs>
+CSMP=?
Description
Set command is used to select values for additional parameters needed when SM is sent to the network or placed in a
storage when text format message mode is selected. It is possible to set the validity period starting from when the SM is
received by the SMSC (<vp> is in range 0... 255) or define the absolute time of the validity period termination (<vp>
is a string). The format of <vp> is given by <fo>. If TA supports the EVPF, see 3GPP TS 23.040 [3], it shall be given
as a hexadecimal coded string (refer e.g. <pdu>) with double quotes.
NOTE: When storing a SMS-DELIVER from the TE to the preferred memory storage in text mode (refer
command Write Message to Memory +CMGW), <vp> field can be used for <scts>.
Are you sure its the one you need to be using? Morality is indistinguishable from social proscription
|
|
|
|
|
Hi all,
I am trying to update VS_VERSION info of my application using this code
VS_VERSIONINFO *pVerInfo;
LPBYTE pOffsetBytes;
VS_FIXEDFILEINFO *pFixedInfo;
LPCTSTR lpszFile = _T("C:\\a.exe");
DWORD dwHandle,
dwSize,
dwResult = 0;
dwSize = GetFileVersionInfoSize(lpszFile, &dwHandle);
if (0 < dwSize)
{
LPBYTE lpBuffer = new BYTE[dwSize];
if (GetFileVersionInfo(lpszFile, 0, dwSize, lpBuffer) != FALSE)
{
#define roundoffs(a,b,r) (((BYTE *) (b) - (BYTE *) (a) + ((r) - 1)) & ~((r) - 1))
#define roundpos(a,b,r) (((BYTE *) (a)) + roundoffs(a,b,r))
pVerInfo = (VS_VERSIONINFO *) lpBuffer;
pOffsetBytes = (BYTE *) &pVerInfo->szKey[_tcslen(pVerInfo->szKey) + 1];
pFixedInfo = (VS_FIXEDFILEINFO *) roundpos(pVerInfo, pOffsetBytes, 4);
pFixedInfo->dwFileVersionMS = 0x11112222;
pFixedInfo->dwFileVersionLS = 0x33334444;
pFixedInfo->dwProductVersionMS = 0x00030010;
pFixedInfo->dwProductVersionLS = 0x00000031;
HANDLE hResource = BeginUpdateResource(lpszFile, FALSE);
if (NULL != hResource)
{
UINT uTemp;
if (VerQueryValue(lpBuffer, _T("\\StringFileInfo\\ProductName"),(LPVOID *) &lpTranslate, &uTemp) != FALSE)
{
if (UpdateResource(hResource, RT_VERSION, MAKEINTRESOURCE(VS_VERSION_INFO), lpTranslate->wLanguage, lpBuffer, dwSize) != FALSE)
{
if (EndUpdateResource(hResource, FALSE) == FALSE)
dwResult = GetLastError();
}
else
dwResult = GetLastError();
}
}
else
dwResult = GetLastError();
}
else
dwResult = GetLastError();
delete [] lpBuffer;
}
else
dwResult = GetLastError();
if (0 != dwResult)
wprintf(_T("Operation was not successful. Result = %lu\n"), dwResult);
else
wprintf(_T("Operation was successful."));
but my problem is that code is updating the files version info but not product info..
Can anybody what i am doing wrong or what i am missing..
thanks in advance
|
|
|
|
|
Hi friends
I am using CDatabase class to open Access database in my program. Sometimes it shows an error "Specified driver could not be loaded due to system error 1114 (MICROSOFT ACCESS DRIVER (*.mdb))". How can i resolve this problem
thanks in advance-kk.tvm-
|
|
|
|
|
i thinks its come from u r not disposing the db object .not exactly ..
could u write your ConnectionString ... Failure is Success If we learn from it!!
|
|
|
|
|
Hi
Connection string as follows
m_strDBConnect = "ODBC;DRIVER={MICROSOFT ACCESS DRIVER (*.mdb)};DSN='';DBQ=c:\abc.mdb"
thanks in advance-kk.tvm-
|
|
|
|
|
i dont know ..why that error comes ..any way u
try this ..
CDatabase dbStar;
CString strConnection = _T("Driver={Microsoft Access Driver (*.mdb)};Dbq=D:\\Sample.MDB;Uid=;Pwd=;");
if ( dbStar.Open(_T(""),false,true,strConnection,true))
{
}
and tell me the result ...? Failure is Success If we learn from it!!
|
|
|
|
|