Click here to Skip to main content
16,011,444 members
Home / Discussions / ATL / WTL / STL
   

ATL / WTL / STL

 
GeneralHandling ActiveX Events in VB Pin
nalinikanth26-Aug-03 3:34
nalinikanth26-Aug-03 3:34 
QuestionHow to run a script (.vbs) in VC++, Please help .... Pin
Atif Bashir26-Aug-03 2:43
Atif Bashir26-Aug-03 2:43 
AnswerRe: How to run a script (.vbs) in VC++, Please help .... Pin
palbano28-Aug-03 8:40
palbano28-Aug-03 8:40 
AnswerRe: How to run a script (.vbs) in VC++, Please help .... Pin
Vi229-Aug-03 4:36
Vi229-Aug-03 4:36 
Generalkeeping track of pointers to objects with STL Pin
Jeremy Pullicino26-Aug-03 0:04
Jeremy Pullicino26-Aug-03 0:04 
GeneralRe: keeping track of pointers to objects with STL Pin
Joaquín M López Muñoz26-Aug-03 3:32
Joaquín M López Muñoz26-Aug-03 3:32 
GeneralRe: keeping track of pointers to objects with STL Pin
Nemanja Trifunovic26-Aug-03 5:07
Nemanja Trifunovic26-Aug-03 5:07 
QuestionHow to load a cursor dymamically, from a dynamically created bitmap? Pin
Garuna25-Aug-03 22:20
Garuna25-Aug-03 22:20 
Confused | :confused: Dear all,
I have a situation like this. For my application i have a bit map, and i wat to set this bitmap cursor in some area of my GUI. the bit map to be set as the cursor is not the original one from the resource, before that i want to rotate the bitmap according to some events like mouse scroll event, ok i can make it rotate the bitmap using the code,HBITMAP CRotateimageDlg::GetRotatedBitmapNT(HBITMAP hBitmap, float radians, COLORREF clrBack)
{
// Create a memory DC compatible with the display
CDC sourceDC, destDC;
sourceDC.CreateCompatibleDC( NULL );
destDC.CreateCompatibleDC( NULL );

// Get logical coordinates
BITMAP bm;
::GetObject( hBitmap, sizeof( bm ), &bm );

float cosine = (float)cos(radians);
float sine = (float)sin(radians);

// Compute dimensions of the resulting bitmap
// First get the coordinates of the 3 corners other than origin
int x1 = (int)(bm.bmHeight * sine);
int y1 = (int)(bm.bmHeight * cosine);
int x2 = (int)(bm.bmWidth * cosine + bm.bmHeight * sine);
int y2 = (int)(bm.bmHeight * cosine - bm.bmWidth * sine);
int x3 = (int)(bm.bmWidth * cosine);
int y3 = (int)(-bm.bmWidth * sine);

int minx = min(0,min(x1, min(x2,x3)));
int miny = min(0,min(y1, min(y2,y3)));
int maxx = max(0,max(x1, max(x2,x3)));
int maxy = max(0,max(y1, max(y2,y3)));

int w = maxx - minx;
int h = maxy - miny;

// Create a bitmap to hold the result
HBITMAP hbmResult = ::CreateCompatibleBitmap(CClientDC(NULL), w, h);

HBITMAP hbmOldSource = (HBITMAP)::SelectObject( sourceDC.m_hDC, hBitmap );
HBITMAP hbmOldDest = (HBITMAP)::SelectObject( destDC.m_hDC, hbmResult );

// Draw the background color before we change mapping mode
HBRUSH hbrBack = CreateSolidBrush( clrBack );
HBRUSH hbrOld = (HBRUSH)::SelectObject( destDC.m_hDC, hbrBack );
destDC.PatBlt( 0, 0, w, h, PATCOPY );
::DeleteObject( ::SelectObject( destDC.m_hDC, hbrOld ) );

// We will use world transform to rotate the bitmap
SetGraphicsMode(destDC.m_hDC, GM_ADVANCED);
XFORM xform;
xform.eM11 = cosine;
xform.eM12 = -sine;
xform.eM21 = sine;
xform.eM22 = cosine;
xform.eDx = (float)-minx;
xform.eDy = (float)-miny;

SetWorldTransform( destDC.m_hDC, &xform );

// Now do the actual rotating - a pixel at a time
destDC.BitBlt(0,0,bm.bmWidth, bm.bmHeight, &sourceDC, 0, 0, SRCCOPY );

// Restore DCs
::SelectObject( sourceDC.m_hDC, hbmOldSource );
::SelectObject( destDC.m_hDC, hbmOldDest );

return hbmResult;

} and can load it in to the image control, but my require ment is another one, how can i load the returned HBITMAP as a cursor?? pls get me if anybody has the idea, or if u have the code snipet pls let me know..

Thanks in advance.

AnuragVelekkattu
GeneralWTL + Time/Date information Pin
Ernesto D.23-Aug-03 22:00
Ernesto D.23-Aug-03 22:00 
GeneralRe: WTL + Time/Date information Pin
Stuart Dootson23-Aug-03 23:18
professionalStuart Dootson23-Aug-03 23:18 
GeneralRe: WTL + Time/Date information Pin
Steve S25-Aug-03 22:19
Steve S25-Aug-03 22:19 
GeneralRe: WTL + Time/Date information Pin
Ernesto D.26-Aug-03 9:46
Ernesto D.26-Aug-03 9:46 
GeneralRe: WTL + Time/Date information Pin
Rob Caldecott26-Aug-03 23:23
Rob Caldecott26-Aug-03 23:23 
GeneralRe: WTL + Time/Date information Pin
Ernesto D.27-Aug-03 14:54
Ernesto D.27-Aug-03 14:54 
GeneralRe: WTL + Time/Date information Pin
Rob Caldecott27-Aug-03 22:05
Rob Caldecott27-Aug-03 22:05 
GeneralRe: WTL + Time/Date information Pin
Steve S27-Aug-03 22:36
Steve S27-Aug-03 22:36 
GeneralRe: WTL + Time/Date information Pin
Ernesto D.28-Aug-03 17:12
Ernesto D.28-Aug-03 17:12 
GeneralRe: WTL + Time/Date information Pin
Steve S28-Aug-03 22:01
Steve S28-Aug-03 22:01 
GeneralRe: WTL + Time/Date information Pin
TW7-Sep-03 23:35
TW7-Sep-03 23:35 
Generalwheather can introduce book about ATL developing, best offer its E- version and HTTP link address. Pin
simonchen.net21-Aug-03 23:27
simonchen.net21-Aug-03 23:27 
GeneralRe: wheather can introduce book about ATL developing, best offer its E- version and HTTP link address. Pin
Roger Stewart25-Aug-03 15:23
professionalRoger Stewart25-Aug-03 15:23 
GeneralRe: wheather can introduce book about ATL developing, best offer its E- version and HTTP link address. Pin
Steve S25-Aug-03 22:34
Steve S25-Aug-03 22:34 
GeneralAbout ATL Pin
rqxiang21-Aug-03 21:24
rqxiang21-Aug-03 21:24 
GeneralActiveX control; problem with wtl CProgressBarCtrl Pin
Anonymous21-Aug-03 21:18
Anonymous21-Aug-03 21:18 
GeneralProblem:install WTL 7.0 on VS.Net 2003 Pin
mizimizi20-Aug-03 23:54
mizimizi20-Aug-03 23:54 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.