|
Hi~
Is there any function which is used for searching a substring?
for example:
LPWSTR a_string = _T("abcdef");
I would like to cut "cde" out and make a new LPWSTR point to it.
How?
Thanks
|
|
|
|
|
wcsstr() is your friend here.
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
"Obviously ??? You're definitely a superstar!!!" mYkel - 21 Jun '04
Within you lies the power for good - Use it!
|
|
|
|
|
If you absolutely positively must use a C-style string, then _tcsstr() is the way to go. Returns a LPTSTR to the position of the first found substring in the original string or NULL if not found.
If you don't really need to use C-style strings, get on the train and use a std::string or std::wstring and its substr() function.
Note! If you explicitly use LPWSTR (as in your question) instead of LPTSTR , then you shouldn't use _T() , but rather L . Otherwise you'll confuse yourself and others by being inconsistent. In other words:
LPWSTR strForcedUnicode = L"abcdef";
LPTSTR strMultibyteOrUnicode = _T("abcdef");
--
The Blog: Bits and Pieces
|
|
|
|
|
here some functions i wrote recently
i have been planning to rewrite them (wrote them in a hurry)
if you want to replace "cde" then just just do
StrReplace( a_string, "cde", "What to replace it with" );
char * SubStr( char * String, long Start = 0, long Length = 0 )
{
if( Length < 1 || Length > (signed) strlen( String ) )
{
Length = strlen( String );
}
char * Result = new char[Length+1];
long lPos = 0;
for( long i = Start; i < Start+Length; i++ )
{
Result[lPos++] = String[i];
}
Result[lPos] = '\0';
return Result;
}
long StrFindFirst( char * String, char * StringFind )
{
for( long i = 0; i < (signed) strlen( String ); i++ )
{
if( !strcmp( SubStr( String, i, strlen( StringFind ) ), SubStr( StringFind, 0, strlen( StringFind ) ) ) )
{
return i;
}
}
return -1;
}
void StrFindAll( long * Array, char * String, char * StringFind )
{
long count = 0;
for( long i = 0; i < (signed) strlen( String ); i++ )
{
if( !strcmp( SubStr( String, i, strlen( StringFind ) ), SubStr( StringFind, 0, strlen( StringFind ) ) ) )
{
Array[count++] = i;
}
}
Array[count] = '\0';
}
long StrFindCount( char * String, char * StringFind )
{
long count = 0;
for( long i = 0; i < (signed) strlen( String ); i++ )
{
if( !strcmp( SubStr( String, i, strlen( StringFind ) ), SubStr( StringFind, 0, strlen( StringFind ) ) ) )
{
count++;
}
}
return count;
}
char * StrReplace( char * String, char * Find, char * Replace )
{
char * NewString = new char[];
long fCount = StrFindCount( String, Find );
long Found[sizeof(String)];
long fPos = 0;
long nPos = 0;
long oPos = 0;
if( fCount > 1024 || fCount < 1 ) return NULL;
StrFindAll( Found, String, Find );
while( oPos < (signed) strlen( String ) )
{
if( oPos == Found[fPos] )
{
fPos++;
for( long x = 0; x < (signed) strlen( Replace ); x++ )
{
NewString[nPos++] = Replace[x];
}
oPos += strlen( Find );
}
else
{
NewString[nPos++] = String[oPos++];
}
}
NewString[nPos] = '\0';
return NewString;
}
|
|
|
|
|
I'm making a DLL that exports some functions that create and configure a window from the MSN Style PopUp window example on CP. Declaring the code goes thru without error but it crashes everytime I try to uae the functions. Please help! here is the code:
#include "stdafx.h"
#include "TaskbarNotifier.h"
#define IDT_HIDDEN 0
#define IDT_APPEARING 1
#define IDT_WAITING 2
#define IDT_DISAPPEARING 3
#define TASKBAR_ON_TOP 1
#define TASKBAR_ON_LEFT 2
#define TASKBAR_ON_RIGHT 3
#define TASKBAR_ON_BOTTOM 4
// CTaskbarNotifier
IMPLEMENT_DYNAMIC(CTaskbarNotifier, CWnd)
CTaskbarNotifier::CTaskbarNotifier()
{
m_strCaption="";
m_pWndParent=NULL;
m_bMouseIsOver=FALSE;
m_hSkinRegion=NULL;
m_hCursor=NULL;
m_crNormalTextColor=RGB(133,146,181);
m_crSelectedTextColor=RGB(10,36,106);
m_nSkinHeight=0;
m_nSkinWidth=0;
m_dwTimeToShow=0;
m_dwTimeToLive=0;
m_dwTimeToHide=0;
m_dwDelayBetweenShowEvents=0;
m_dwDelayBetweenHideEvents=0;
m_nStartPosX=0;
m_nStartPosY=0;
m_nCurrentPosX=0;
m_nCurrentPosY=0;
m_nIncrement=2;
m_nTaskbarPlacement=0;
m_nAnimStatus=IDT_HIDDEN;
m_rcText.SetRect(0,0,0,0);
}
CTaskbarNotifier::~CTaskbarNotifier()
{
// No need to delete the HRGN, SetWindowRgn() owns it after being called
}
int CTaskbarNotifier::Create(CWnd *pWndParent)
{
m_pWndParent=pWndParent;
CString strWndClass=AfxRegisterWndClass(0,AfxGetApp()->LoadStandardCursor(IDC_ARROW),GetSysColorBrush(COLOR_WINDOW),NULL);
return CreateEx(0,strWndClass,NULL,WS_POPUP,0,0,0,0,pWndParent->m_hWnd,NULL);
}
void CTaskbarNotifier::SetTextFont(LPCTSTR szFont,int nSize,int nNormalStyle,int nSelectedStyle)
{
LOGFONT lf;
m_myNormalFont.DeleteObject();
m_myNormalFont.CreatePointFont(nSize,szFont);
m_myNormalFont.GetLogFont(&lf);
// We set the Font of the unselected ITEM
if (nNormalStyle & TN_TEXT_BOLD)
lf.lfWeight = FW_BOLD;
else
lf.lfWeight = FW_NORMAL;
if (nNormalStyle & TN_TEXT_ITALIC)
lf.lfItalic=TRUE;
else
lf.lfItalic=FALSE;
if (nNormalStyle & TN_TEXT_UNDERLINE)
lf.lfUnderline=TRUE;
else
lf.lfUnderline=FALSE;
m_myNormalFont.DeleteObject();
m_myNormalFont.CreateFontIndirect(&lf);
// We set the Font of the selected ITEM
if (nSelectedStyle & TN_TEXT_BOLD)
lf.lfWeight = FW_BOLD;
else
lf.lfWeight = FW_NORMAL;
if (nSelectedStyle & TN_TEXT_ITALIC)
lf.lfItalic=TRUE;
else
lf.lfItalic=FALSE;
if (nSelectedStyle & TN_TEXT_UNDERLINE)
lf.lfUnderline=TRUE;
else
lf.lfUnderline=FALSE;
m_mySelectedFont.DeleteObject();
m_mySelectedFont.CreateFontIndirect(&lf);
}
void CTaskbarNotifier::SetTextColor(COLORREF crNormalTextColor,COLORREF crSelectedTextColor)
{
m_crNormalTextColor=crNormalTextColor;
m_crSelectedTextColor=crSelectedTextColor;
RedrawWindow();
}
void CTaskbarNotifier::SetTextRect(RECT rcText)
{
m_rcText=rcText;
}
BOOL CTaskbarNotifier::SetSkin(UINT nBitmapID,short red,short green,short blue)
{
BITMAP bm;
m_biSkinBackground.DeleteObject();
if (!m_biSkinBackground.LoadBitmap(nBitmapID))
return FALSE;
GetObject(m_biSkinBackground.GetSafeHandle(), sizeof(bm), &bm);
m_nSkinWidth=bm.bmWidth;
m_nSkinHeight=bm.bmHeight;
m_rcText.SetRect(0,0,bm.bmWidth,bm.bmHeight);
if (red!=-1 && green!=-1 && blue!=-1)
{
// No need to delete the HRGN, SetWindowRgn() owns it after being called
m_hSkinRegion=GenerateRegion((HBITMAP)m_biSkinBackground.GetSafeHandle(),(BYTE) red,(BYTE) green,(BYTE) blue);
SetWindowRgn(m_hSkinRegion, true);
}
return TRUE;
}
BOOL CTaskbarNotifier::SetSkin(LPCTSTR szFileName,short red,short green,short blue)
{
BITMAP bm;
HBITMAP hBmp;
hBmp=(HBITMAP) ::LoadImage(AfxGetInstanceHandle(),szFileName,IMAGE_BITMAP,0,0, LR_LOADFROMFILE);
if (!hBmp)
return FALSE;
m_biSkinBackground.DeleteObject();
m_biSkinBackground.Attach(hBmp);
GetObject(m_biSkinBackground.GetSafeHandle(), sizeof(bm), &bm);
m_nSkinWidth=bm.bmWidth;
m_nSkinHeight=bm.bmHeight;
m_rcText.SetRect(0,0,bm.bmWidth,bm.bmHeight);
if (red!=-1 && green!=-1 && blue!=-1)
{
// No need to delete the HRGN, SetWindowRgn() owns it after being called
m_hSkinRegion=GenerateRegion((HBITMAP)m_biSkinBackground.GetSafeHandle(),(BYTE) red,(BYTE) green,(BYTE) blue);
SetWindowRgn(m_hSkinRegion, true);
}
return TRUE;
}
void CTaskbarNotifier::Show(LPCTSTR szCaption,DWORD dwTimeToShow,DWORD dwTimeToLive,DWORD dwTimeToHide,int nIncrement)
{
unsigned int nDesktopHeight;
unsigned int nDesktopWidth;
unsigned int nScreenWidth;
unsigned int nScreenHeight;
CRect rcDesktop;
m_strCaption=szCaption;
m_dwTimeToShow=dwTimeToShow;
m_dwTimeToLive=dwTimeToLive;
m_dwTimeToHide=dwTimeToHide;
::SystemParametersInfo(SPI_GETWORKAREA,0,&rcDesktop,0);
nDesktopWidth=rcDesktop.right-rcDesktop.left;
nDesktopHeight=rcDesktop.bottom-rcDesktop.top;
nScreenWidth=::GetSystemMetrics(SM_CXSCREEN);
nScreenHeight=::GetSystemMetrics(SM_CYSCREEN);
BOOL bTaskbarOnRight=nDesktopWidth<nscreenwidth &&="" rcdesktop.left="=0;
" bool="" btaskbaronleft="nDesktopWidth<nScreenWidth" rcdesktop.left!="0;
" btaskbarontop="nDesktopHeight<nScreenHeight" rcdesktop.top!="0;
" btaskbaronbottom="nDesktopHeight<nScreenHeight" rcdesktop.top="=0;
"
="" switch="" (m_nanimstatus)
="" {
="" case="" idt_hidden:
="" showwindow(sw_show);
="" if="" (btaskbaronright)
="" m_dwdelaybetweenshowevents="m_dwTimeToShow/(m_nSkinWidth/m_nIncrement);
" m_dwdelaybetweenhideevents="m_dwTimeToHide/(m_nSkinWidth/m_nIncrement);
" m_nstartposx="rcDesktop.right;
" m_nstartposy="rcDesktop.bottom-m_nSkinHeight;
" m_ntaskbarplacement="TASKBAR_ON_RIGHT;
" }
="" else="" (btaskbaronleft)
="" (btaskbarontop)
="" (btaskbaronbottom)
="" taskbar="" is="" on="" the="" bottom="" or="" invisible
="" }
="" m_ncurrentposx="m_nStartPosX;
" m_ncurrentposy="m_nStartPosY;
" settimer(idt_appearing,m_dwdelaybetweenshowevents,null);
="" break;
="" idt_waiting:
="" redrawwindow();
="" killtimer(idt_waiting);
="" settimer(idt_waiting,m_dwtimetolive,null);
="" idt_appearing:
="" idt_disappearing:
="" killtimer(idt_disappearing);
="" setwindowpos(null,m_ncurrentposx,m_ncurrentposy,m_nskinwidth,m_nskinheight,swp_noownerzorder="" |="" swp_nozorder="" swp_noactivate);
="" break;
="" }
}
void="" ctaskbarnotifier::hide()
{
="" killtimer(idt_appearing);
="" movewindow(0,0,0,0);
="" showwindow(sw_hide);
="" m_nanimstatus="IDT_HIDDEN;
}
HRGN" ctaskbarnotifier::generateregion(hbitmap="" hbitmap,="" byte="" red,="" green,="" blue)
{
="" word="" wbmpwidth,wbmpheight;
="" hrgn="" hrgn,="" htmprgn;
="" 24bit="" pixels="" from="" bitmap
="" *ppixels="Get24BitPixels(hBitmap," &wbmpwidth,="" &wbmpheight);
="" (!ppixels)="" return="" null;
="" create="" our="" working="" region
="" (!hrgn)="" {="" delete="" ppixels;="" null;="" dword="" p="0;
" for="" (word="" y="0;" y<wbmpheight;="" y++)
="" x="0;" x<wbmpwidth;="" x++)
="" jred="pPixels[p+2];
" jgreen="pPixels[p+1];
" jblue="pPixels[p+0];
" (jred="=red" remove="" transparent="" color="" htmprgn="CreateRectRgn(x,y,x+1,y+1);
" combinergn(hrgn,="" htmprgn,="" rgn_xor);
="" deleteobject(htmprgn);
="" next="" pixel
="" p+="3;
" release="" pixels
="" ppixels;
="" hrgn;
}
byte*="" ctaskbarnotifier::get24bitpixels(hbitmap="" pbitmap,="" *pwwidth,="" *pwheight)
{
="" bitmap="" bmpbmp;
="" lpbitmapinfo="" pbmiinfo;
="" bitmapinfo="" bmiinfo;
="" wbmpwidth,="" wbmpheight;
="" getobject(pbitmap,="" sizeof(bmpbmp),&bmpbmp);
="" pbmiinfo="(LPBITMAPINFO)&bmpBmp;
" wbmpwidth="(WORD)pbmiInfo-">bmiHeader.biWidth;
wBmpWidth -= (wBmpWidth%4);
wBmpHeight = (WORD)pbmiInfo->bmiHeader.biHeight;
*pwWidth = wBmpWidth;
*pwHeight = wBmpHeight;
BYTE *pPixels = new BYTE[wBmpWidth*wBmpHeight*3];
if (!pPixels) return NULL;
HDC hDC =::GetWindowDC(NULL);
bmiInfo.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
bmiInfo.bmiHeader.biWidth = wBmpWidth;
bmiInfo.bmiHeader.biHeight = -wBmpHeight;
bmiInfo.bmiHeader.biPlanes = 1;
bmiInfo.bmiHeader.biBitCount = 24;
bmiInfo.bmiHeader.biCompression = BI_RGB;
bmiInfo.bmiHeader.biSizeImage = wBmpWidth*wBmpHeight*3;
bmiInfo.bmiHeader.biXPelsPerMeter = 0;
bmiInfo.bmiHeader.biYPelsPerMeter = 0;
bmiInfo.bmiHeader.biClrUsed = 0;
bmiInfo.bmiHeader.biClrImportant = 0;
// get pixels from the original bitmap converted to 24bits
int iRes = GetDIBits(hDC,pBitmap,0,wBmpHeight,(LPVOID)pPixels,&bmiInfo,DIB_RGB_COLORS);
// release the device context
::ReleaseDC(NULL,hDC);
// if failed, cancel the operation.
if (!iRes)
{
delete pPixels;
return NULL;
};
// return the pixel array
return pPixels;
}
BEGIN_MESSAGE_MAP(CTaskbarNotifier, CWnd)
// ON_WM_CREATE()
// ON_WM_MOUSEMOVE()
// ON_WM_DESTROY()
// ON_WM_ERASEBKGND()
// ON_WM_PAINT()
// ON_MESSAGE(WM_MOUSELEAVE, OnMouseLeave)
// ON_MESSAGE(WM_MOUSEHOVER, OnMouseHover)
// ON_WM_SETCURSOR()
ON_WM_LBUTTONUP()
// ON_WM_TIMER()
END_MESSAGE_MAP()
// CTaskbarNotifier message handlers
/*
int CTaskbarNotifier::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CWnd::OnCreate(lpCreateStruct) == -1)
return -1;
m_hCursor = ::LoadCursor(NULL, MAKEINTRESOURCE(32649));
return 0;
}
void CTaskbarNotifier::OnDestroy()
{
CWnd::OnDestroy();
// TODO: Add your message handler code here
}
void CTaskbarNotifier::OnMouseMove(UINT nFlags, CPoint point)
{
TRACKMOUSEEVENT t_MouseEvent;
t_MouseEvent.cbSize = sizeof(TRACKMOUSEEVENT);
t_MouseEvent.dwFlags = TME_LEAVE | TME_HOVER;
t_MouseEvent.hwndTrack = m_hWnd;
t_MouseEvent.dwHoverTime = 1;
::_TrackMouseEvent(&t_MouseEvent);
CWnd::OnMouseMove(nFlags, point);
}
*/
void CTaskbarNotifier::OnLButtonUp(UINT nFlags, CPoint point)
{
m_pWndParent->PostMessage(WM_TASKBARNOTIFIERCLICKED,0,0);
CWnd::OnLButtonUp(nFlags, point);
}
/*
LRESULT CTaskbarNotifier::OnMouseHover(WPARAM w, LPARAM l)
{
if (m_bMouseIsOver==FALSE)
{
m_bMouseIsOver=TRUE;
RedrawWindow();
}
return 0;
}
LRESULT CTaskbarNotifier::OnMouseLeave(WPARAM w, LPARAM l)
{
if (m_bMouseIsOver==TRUE)
{
m_bMouseIsOver=FALSE;
RedrawWindow();
}
return 0;
}
BOOL CTaskbarNotifier::OnEraseBkgnd(CDC* pDC)
{
CDC memDC;
CBitmap *pOldBitmap;
BITMAP bm;
memDC.CreateCompatibleDC(pDC);
GetObject(m_biSkinBackground.GetSafeHandle(), sizeof(bm), &bm);
pOldBitmap=memDC.SelectObject(&m_biSkinBackground);
pDC->BitBlt(0,0,bm.bmWidth,bm.bmHeight,&memDC,0,0,SRCCOPY);
memDC.SelectObject(pOldBitmap);
return TRUE;
}
void CTaskbarNotifier::OnPaint()
{
CPaintDC dc(this);
CRect rcClient;
CFont *pOldFont;
char *szBuffer;
if (m_bMouseIsOver)
{
dc.SetTextColor(m_crSelectedTextColor);
pOldFont=dc.SelectObject(&m_mySelectedFont);
}
else
{
dc.SetTextColor(m_crNormalTextColor);
pOldFont=dc.SelectObject(&m_myNormalFont);
}
szBuffer=new char[m_strCaption.GetLength()+10];
strcpy(szBuffer,m_strCaption);
dc.SetBkMode(TRANSPARENT);
rcClient.DeflateRect(10,20,10,20);
dc.DrawText(szBuffer,-1,m_rcText,DT_CENTER | DT_VCENTER | DT_WORDBREAK | DT_END_ELLIPSIS);
delete[] szBuffer;
dc.SelectObject(pOldFont);
}
BOOL CTaskbarNotifier::OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message)
{
if (nHitTest == HTCLIENT)
{
::SetCursor(m_hCursor);
return TRUE;
}
return CWnd::OnSetCursor(pWnd, nHitTest, message);
}
void CTaskbarNotifier::OnTimer(UINT nIDEvent)
{
switch (nIDEvent)
{
case IDT_APPEARING:
m_nAnimStatus=IDT_APPEARING;
switch(m_nTaskbarPlacement)
{
case TASKBAR_ON_BOTTOM:
if (m_nCurrentPosY>(m_nStartPosY-m_nSkinHeight))
m_nCurrentPosY-=m_nIncrement;
else
{
KillTimer(IDT_APPEARING);
SetTimer(IDT_WAITING,m_dwTimeToLive,NULL);
m_nAnimStatus=IDT_WAITING;
}
break;
case TASKBAR_ON_TOP:
if ((m_nCurrentPosY-m_nStartPosY)<m_nskinheight)
m_ncurrentposy+="m_nIncrement;
" else
="" {
="" killtimer(idt_appearing);
="" settimer(idt_waiting,m_dwtimetolive,null);
="" m_nanimstatus="IDT_WAITING;
" }
="" break;
="" case="" taskbar_on_left:
="" if="" ((m_ncurrentposx-m_nstartposx)<m_nskinwidth)
="" m_ncurrentposx+="m_nIncrement;
" taskbar_on_right:
="" (m_ncurrentposx="">(m_nStartPosX-m_nSkinWidth))
m_nCurrentPosX-=m_nIncrement;
else
{
KillTimer(IDT_APPEARING);
SetTimer(IDT_WAITING,m_dwTimeToLive,NULL);
m_nAnimStatus=IDT_WAITING;
}
break;
}
SetWindowPos(NULL,m_nCurrentPosX,m_nCurrentPosY,m_nSkinWidth,m_nSkinHeight,SWP_NOOWNERZORDER | SWP_NOZORDER | SWP_NOACTIVATE);
//RedrawWindow();
break;
case IDT_WAITING:
KillTimer(IDT_WAITING);
SetTimer(IDT_DISAPPEARING,m_dwDelayBetweenHideEvents,NULL);
break;
case IDT_DISAPPEARING:
m_nAnimStatus=IDT_DISAPPEARING;
switch(m_nTaskbarPlacement)
{
case TASKBAR_ON_BOTTOM:
if (m_nCurrentPosY<m_nstartposy)
m_ncurrentposy+="m_nIncrement;
" else
="" {
="" killtimer(idt_disappearing);
="" hide();
="" }
="" break;
="" case="" taskbar_on_top:
="" if="" (m_ncurrentposy="">m_nStartPosY)
m_nCurrentPosY-=m_nIncrement;
else
{
KillTimer(IDT_DISAPPEARING);
Hide();
}
break;
case TASKBAR_ON_LEFT:
if (m_nCurrentPosX>m_nStartPosX)
m_nCurrentPosX-=m_nIncrement;
else
{
KillTimer(IDT_DISAPPEARING);
Hide();
}
break;
case TASKBAR_ON_RIGHT:
if (m_nCurrentPosX<m_nstartposx)
m_ncurrentposx+="m_nIncrement;
" else
="" {
="" killtimer(idt_disappearing);
="" hide();
="" }
="" break;
="" setwindowpos(null,m_ncurrentposx,m_ncurrentposy,m_nskinwidth,m_nskinheight,swp_noownerzorder="" |="" swp_nozorder="" swp_noactivate);
="" redrawwindow();
="" }
="" cwnd::ontimer(nidevent);
}
*=""
and="" the="" functions="" are:
#define="" export="" extern="" "c"="" __declspec(="" dllexport="" )
#include="" "declare.h"
ctaskbarnotifier="" dialog1;
ctaskbarnotifier*="" dialog="&dialog1;
long" dietime="500;
long" staytime="3000;
long" showtime="500;
export" pchar="" initiate()
{
="" dialog-="">Create(NULL);
return "MSN Style Taskbar Notification PopUp DLL by Tyrant";
}
export void Show(PCHAR caption, int misc)
{
dialog->Show(caption,showTime,stayTime,dieTime,misc);
}
export void setTimeOptions(long comeUp, long stay, long down)
{
int stayTime=stay;
int showTime=comeUp;
int dieTime=down;
}
export void SetSkin(PCHAR file, short red, short green, short blue)
{
dialog->SetSkin(file,red,green,blue);
}
export void SetFont(LPCTSTR font, int size, DWORD normal, DWORD spec)
{
dialog->SetTextFont(font, size,normal,spec);
}
export void TextColor(COLORREF normal,COLORREF not)
{
dialog->SetTextColor(normal,not);
}
export void SetTextArea(long x, long y, long width, long height)
{
dialog->SetTextRect(CRect(x,y,width,height));
}
Thnx in advance for anybody taht helps me.
|
|
|
|
|
Hello,
I dont normally ask stuff like this, but I haven't been able to find an answer anywhere
I'm writing an app in windows(MFC) (I have what I think is at _least_ a basic understanding of writing these things, but windows programming is not my forte)
I'm looking to find mouse coordinates in the client area, an easy task you might think...
But alas, no.
The app has 5 ctrl bars dotted about, 2 of which start docked to the sides, and 1 toolbar/ctrlbar, which starts docked to the top. I can access the ctrl bars and do stuff when buttons are clicked and sliders are slid.
hmmm. lets say its a paint app (NDA's etc :/)
what i want to do is pick a tool from the ctrl bar, which i can do, and draw onto the main white bit of the window(the client area, if im correct).
But, because I've got docked things, ScreentoClient doesnt work the way I'd like it to:
GetCursorPos(&c);
ScreenToClient(AfxGetMainWnd()->m_hWnd, &c);
This doesn't return the cursor relative to the TopLeft of the white bit, but to the point below the menubar, where I assume the windows actual client area starts.
So I supose what I'm asking is how do I get the TL corner of the white area? or even if it has different name, what is it called, so I can at least look for the right thing, clientArea isnt tuning up much for me.
I hope that all made sense to someone at least.
Thanks in advance to anyone who takes the time to look at this.
|
|
|
|
|
Sorted it now, turns out that the white bit was a seperate child window or similar, not too sure. I:m building off of some other code.
But it works now, and thats what matters
|
|
|
|
|
Does anyone know where i could get a copy of it?
my copy of VS doesnt seem to come with it.
|
|
|
|
|
tried google?
"If I don't see you in this world, I'll see you in the next one... and don't be late." ~ Jimi Hendrix
|
|
|
|
|
That question is getting kinda annoying,
if i hadnt tried google first then why i post here first?
http://www.google.com/search?q=windowsx.txt&sourceid=mozilla-search&start=0&start=0&ie=utf-8&oe=utf-8
do you see anything helpful ?
i see a microsoft artical( doesnt provde much info ), and some non-relative links
|
|
|
|
|
www.ticalc.org/archives/files/fileinfo/345/34562.html [^]
Maybe it's this?
I'm sorry if you're getting annoyed,but I'm only trying to help!
I usually find files by searching google on filename + download
Hope this link is what you're looking for.
"If I don't see you in this world, I'll see you in the next one... and don't be late." ~ Jimi Hendrix
|
|
|
|
|
no, thats a prog someone wrote for TI-83 Graphing Calc's
although it does have a document name windowsx.txt it was written by the person who wrote the prog and is not the document im looking for
the windowsx.txt file im looking for is a microsoft sdk document with details about Message Crackers
ie. HANDLE_MSG()
|
|
|
|
|
When I use the CSliderCtrl control ,set the style as vertical,
But get the upper position is small and lower position is big,
How can I set as the lower big and upper small?
Thanks!!!
Nothing ,nothing ,I am a leaner.
|
|
|
|
|
hi,
I want to zoom in and zoom out a bitmap.
how can i do this
any sample ,, or help.
thanx
|
|
|
|
|
http://www.codeproject.com/miscctrl/wndimg.asp[^]
The referenced article uses StretchBlt() to scale the image.
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
"Obviously ??? You're definitely a superstar!!!" mYkel - 21 Jun '04
Within you lies the power for good - Use it!
|
|
|
|
|
Hi , thanx for guiding me .
But i m not getting any clue from this.
I only want to zoom it ,,ur sample application is doing many things
i m confused with this
waitng for more prompt answer
thanx
|
|
|
|
|
If you want to zoom a bitmap, that is the same as stretching it. So use the StretchBlt() function. By specifying the destination coordinates to be larger than the source coordinates you will get the effect of zooming in. By making the destination coordinates smaller than the source coordinates you get the effect of zooming out.
Look up StretchBlt() (or CDC::StretchBlt() ) in MSDN for more information.
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
"Obviously ??? You're definitely a superstar!!!" mYkel - 21 Jun '04
Within you lies the power for good - Use it!
|
|
|
|
|
hi all!!
i have a small problem. i have designed an application which uses MS-ACCESS to log data. now, my application can be started only by administrator. when i log in as any other user other than the administrator my application will not start. but if i had started it as administrator and then logged in as any other user, it should run. The application no doubtedly runs but the the logging does not happen. i think this happens because, the databse gets closed when i log off as administrator. is there any way that i log off but the database does not close. or any other solution that u ppl can suggest me.
|
|
|
|
|
are you sure, your app is running after logout??
is it a normal windows app? I'm sure, all user-apps are killed on logof.
|
|
|
|
|
my application is interfaced to a driver that i have written. the application is destroyed no doubt. but the driver is not until shut down. so when i log in i re-create the user-land windows application. will event log work in my case instead of database?
|
|
|
|
|
I wrote a service, and this service has some connections to a access-databse and a ms-sql server database... and it works quite well.
so... theoreticly.. your approach should work
|
|
|
|
|
Hello,
Which is better?
ADO by Importing ADODLL and _ConnectionPtr and...
or
DAO
using CDaoDatabase and...
Best Wishes.
Thanks.
|
|
|
|
|
ADO. Better yet, use raw OLEDB.
|
|
|
|
|
Ok, in most of the Open/Save dialogs i see professional programs using it has 5 buttons on the left side (History, Desktop, My Documents, My Computer, and My Networking places)
i am already familiar with how to use the CFileDialog class, but i cant get those buttons to show up, so is just becuase i havn't found the right parameter to add, or does MFC just not offer a template class for that?
|
|
|
|
|
I believe all you have to do is #define _WIN32_WINNT 0x0500 in your stdafx.h file. Just be aware that your app will not work on Win9x or NT4 if you do.
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
"Obviously ??? You're definitely a superstar!!!" mYkel - 21 Jun '04
Within you lies the power for good - Use it!
|
|
|
|
|