|
Here's how I did it.
I had a window "PCTV Vision" that I had to send ALT-R.
I used a tool simillar to Spy++, it comes with Borland Delphi 3 and it is called Winsight32.
With WInsight I selected that window and I started logging all the messages that went to that window. Then I made it active and pressed ALT-R from the keyboard.
I returned to WInsight32 and looked in the message log. I found there a WM_COMMAND which he recognized as "Accelerator".
I shamelessly copied the WParam and Lparam and pasted it in my program which sounds like
PostMessage(hwnd,WM_COMMAND,stolen_WPARAM,stolen_LPARAM);
The good part is that it works!!!
I never tried Spy++ because I haven't installed Visual Studio Completely and it isn't installed.
|
|
|
|
|
Hello,
I am trying to draw tab text a different color if the tab receives a TCM_HIGHLIGHTITEM message.. I have created my CTabCtrlEx class and did a override for DrawItem.. My tab control is coloring selected item text blue and none selected items default (black) now I want to catch the TCM_HIGHLIGHTITEM message and color that text red... Here's what I have so far (the problem is that the red doesn't work)
void CTabCtrlEx::DrawItem(LPDRAWITEMSTRUCT lpDIS)
{
TC_ITEM tci;
CDC* pDC = CDC::FromHandle(lpDIS->hDC);
HIMAGELIST hilTabs = (HIMAGELIST)TabCtrl_GetImageList(GetSafeHwnd());
BOOL bSelected = (lpDIS->itemID == (UINT)GetCurSel());
CRect rItem(lpDIS->rcItem);
if (bSelected)
rItem.bottom -= 1;
else
rItem.bottom += 2;
pDC->FillSolidRect(rItem, ::GetSysColor(COLOR_3DFACE));
rItem.left += PADDING;
rItem.top += PADDING + (bSelected ? 1 : 0);
pDC->SetBkMode(TRANSPARENT);
CString sTemp;
tci.mask = TCIF_TEXT | TCIF_IMAGE;
tci.pszText = sTemp.GetBuffer(100);
tci.cchTextMax = 99;
GetItem(lpDIS->itemID, &tci);
sTemp.ReleaseBuffer();
if (hilTabs)
{
ImageList_Draw(hilTabs, tci.iImage, *pDC, rItem.left, rItem.top, ILD_TRANSPARENT);
rItem.left += 16 + PADDING;
}
rItem.right -= PADDING;
FormatText(sTemp, pDC, rItem.Width());
if((lpDIS->itemState & ODS_SELECTED) && (lpDIS->itemAction & (ODA_SELECT | ODA_DRAWENTIRE)))
pDC->SetTextColor(RGB(0,0,255));
else if(lpDIS->itemState & TCIS_HIGHLIGHTED)
pDC->SetTextColor(RGB(255,0,0));
pDC->DrawText(sTemp, rItem, DT_NOPREFIX | DT_CENTER);
}
Any ideas?
Whoever said nothing's impossible never tried slamming a revolving door!
|
|
|
|
|
Just incase anyone has the same problem here's the fix / working code..
void CTabCtrlEx::DrawItem(LPDRAWITEMSTRUCT lpDIS)
{
CDC* pDC = CDC::FromHandle(lpDIS->hDC);
HIMAGELIST hilTabs = (HIMAGELIST)TabCtrl_GetImageList(GetSafeHwnd());
BOOL bSelected = (lpDIS->itemID == (UINT)GetCurSel());
CRect rItem(lpDIS->rcItem);
if (bSelected)
rItem.bottom -= 1;
else
rItem.bottom += 2;
pDC->FillSolidRect(rItem, ::GetSysColor(COLOR_3DFACE));
rItem.left += PADDING;
rItem.top += PADDING + (bSelected ? 1 : 0);
pDC->SetBkMode(TRANSPARENT);
CString sTemp;
TC_ITEM tci;
tci.mask = (TCIF_TEXT | TCIF_IMAGE | TCIF_STATE | TCIF_PARAM);
tci.dwStateMask = TCIS_HIGHLIGHTED;
tci.pszText = sTemp.GetBuffer(100);
tci.cchTextMax = 99;
tci.dwState = TCIS_HIGHLIGHTED;
GetItem(lpDIS->itemID, &tci);
sTemp.ReleaseBuffer();
if (hilTabs)
{
ImageList_Draw(hilTabs, tci.iImage, *pDC, rItem.left, rItem.top, ILD_TRANSPARENT);
rItem.left += 16 + PADDING;
}
rItem.right -= PADDING;
FormatText(sTemp, pDC, rItem.Width());
if((lpDIS->itemState & ODS_SELECTED) && (lpDIS->itemAction & (ODA_SELECT | ODA_DRAWENTIRE)))
pDC->SetTextColor(RGB(0,0,255));
else if((tci.dwState & TCIS_HIGHLIGHTED) && (lpDIS->itemAction & ODA_DRAWENTIRE))
{
pDC->SetTextColor(RGB(255,0,0));
}
pDC->DrawText(sTemp, rItem, DT_NOPREFIX | DT_CENTER);
}
Whoever said nothing's impossible never tried slamming a revolving door!
|
|
|
|
|
Dear All,
Anybody have a example program of captioned title ? how can I do it ? I would make the text and graphic rotate about Y axis ?
Regards,.
Anson
|
|
|
|
|
Rotating text is not that hard. See the lfEscapement parameter of the LOGFONT structure. As for graphics, you will either need to write your own or get ahold of a graphics/DIB/BMP library.
onwards and upwards...
|
|
|
|
|
Hi!
i've build an vs.net 2003 addin using the addin wizard. is it possible to run the addin on visual studio.net 2002 too?
thanks
|
|
|
|
|
hello,
urgent need on INA Grid Control...
requires samples how it works
it is a 3rd party control ...
requires articles & URLS for that.
thanks
skpanda
|
|
|
|
|
hello ,
how to enumerate name of domains & the name of computers connected to each domain in a network . using win32 api..
any type of application is welcome whether it will be in MFC, COM or ATL or WIN 32
MFC / WIN32 most wanted...
please give tips & snipet of code if available ...give also URLs & site address...
skpanda
|
|
|
|
|
One solution is NetServerEnum(). Check out MSDN.
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/netmgmt/netmgmt/netserverenum.asp
Kuphryn
|
|
|
|
|
hello again,
i refered your suggession and created one MFC application ....in which i m creating a button , a combo box a list box and some other control for my project.
1. what i did (achieved) is :
when i clicked the button the application is flooding the no of domains ,servers and the individual computers at a time in a sequence by a callback function NetServerEnum() (callback --->i think so till now not checked) & i m displaying in the list box. but my requirement is different in the following manner ....
2. my requirement is :
when i click the button the application should enumerate the no of domains first and should put in the combo box.then when i will select one of the domain from the combo , i should get the list of computers in that particular domain , which i want to show in the list box.
how to do that ... using the same function ...??
please guide me ...
thanking u.
panda
|
|
|
|
|
Hi,
I need to access the XML data stored in a IWebBrowser2 (a CHtmlView in fact) to update some nodes without reloading the page, but I can't find how to do this.
I can update the final HTML result, but not the original XML data (I use XSLT to display the data)
Do someone have an idea ?
Thx
MistER-j
|
|
|
|
|
Off the top of my head and I say this isn't possible. I'm using the Webbrowser control in a new app (see www.surfulater.com[^]) and have written a lot of code to interact with it, but I haven't tried embedding standard Windows controls. You can probably only do this with an ActiveX control.
Neville Franks, Author of ED for Windows www.getsoft.com and coming soon: Surfulater www.surfulater.com
|
|
|
|
|
Hi,
I am trying to print to a network printer from a isapi exstension service on a web server. Basically I want to have the web server print a label automatically in response to certain http posts from a client. Ive got everything going except for the most important part. The printing. I cant seem to find any info on printing without using some sort of form. I would like to just print two, centered lines to a label printer. Any Ideas on this? Much Thanks in advance.
|
|
|
|
|
Your ISAPI dll is just another dll except that it is called by a web server instead of an application. You can call the traditional device context functions to print, such as CreateDC("WINSPOOL", "HP LaserJet 5P", NULL, NULL) and StartDoc, StartPage, gdi drawing functions, EndPage, EndDoc, DeleteDC, or you can opt to write directly to the print spooler with functions such as OpenPrinter, StartDocPrinter, StartPagePrinter, WritePrinter, EndPagePrinter, EndDocPrinter, and ClosePrinter.
The only real restrictions are that you should not create any windows, nor should you assume that you can access network resources, since your dll may be running under the localsystem account.
If you choose the DC method, you can use the WINAPI functions with HDC handles, or choose to use the MFC CDC class.
onwards and upwards...
|
|
|
|
|
I have created a ActiveX control using ATL.
The ATL control houses an MFC based control (that is use in other app). The ActiveX library also makes uses of some code that uses sockets and is multithreaded. The DLL itself is a CWinApp based class.
The problem is that when the DLL registers itself, all the initialization calls work fine, but when the closing ExitInstance call is made, it hangs while I try and clean up a thread, first telling the thread to stop, and then calling
WaitForSingleObject( threadHandle, INFINITE );
to wait till it's gone. This works fine when the code is used in an EXE, but used as part of the ActiveX DLL it just hangs.
Is there some trick I am missing to making an ATL based ActiveX control work with multiple worker threads?
¡El diablo está en mis pantalones! ¡Mire, mire!
Real Mentats use only 100% pure, unfooled around with Sapho Juice(tm)!
SELECT * FROM User WHERE Clue > 0
0 rows returned
|
|
|
|
|
How are you telling the tread to stop? If you control is Apartment threaded and you make an incoming call to the thread that created an (COM) object after you have told the thread to stop, you must pump messages as you wait for a worker thread to stop.
Try replacing the WaitForSingleObject with MsgWaitForMultipleObjects - including a message pump. Do a search for MsgWaitForMultipleObjects on MSDN, there is an example in there somewhere.
If that doesn't work try posting the code for the worker thread (the main 'loop' of it) along with what you do to make it stop.
|
|
|
|
|
Hey everyone,
I was wondering what would be the best way for me to prevent memory leaks in my application. I was also wondering if anyone could tell me how to test or check for memory leaks possibly caused by my application? Thanks in advance for your help!!
|
|
|
|
|
|
I will diffently try this out......Thanks John!
|
|
|
|
|
I use it with my development and it helps a lot.
John
|
|
|
|
|
BrockVnm wrote:
I was wondering what would be the best way for me to prevent memory leaks in my application.
Good coding practice will remove all but a few "documented" leaks in the OS/frameworks.
if on Windows and using MFC, you can and should use the DEBUG_NEW macros to help you trace some of the memory leaks.
#ifdef _DEBUG<br />
#define new DEBUG_NEW<br />
#undef THIS_FILE<br />
static char THIS_FILE[] = __FILE__;<br />
#endif
Maximilien Lincourt
Your Head A Splode - Strong Bad
|
|
|
|
|
BrockVnm wrote:
what would be the best way for me to prevent memory leaks in my application.
Follow some simple rules:
1. Use smart pointers rather than "raw" ones. I reccomend ones from the Boost library. Watch for circular references when you use reference counted ones.
2. If you must use raw pointers, before every new put a comment like: "Who is responsible for deleting this?" and make sure that a matching delete is called in all scenarios.
3. If appropriate, look for some garbage collector library. At least one of them can be found on Code Project, and the most popular one is Boehm's[^].
|
|
|
|
|
Nemanja Trifunovic wrote:
If you must use raw pointers, before every new put a comment like: "Who is responsible for deleting this?" and make sure that a matching delete is called in all scenarios.
Or do what I do - as soon as you write a new statement, immediately write the corresponding delete statement. Same with any other memory allocation.
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
Hi All,
Iam not able to delete a directory, which has more than three dot(.)s in its name using SHFileOperation. But iam able to delete directory will two dot(.)s. Why this happens?
Eg. Iam able to delete directory named "1212.1212". But, Iam not able to delete directory named "192.168.1.133".
I get message as
"Cannot delete file: cannot read from source file or disk".
but the directory is present.
How can i delete this directory??
Is this due to Dos Name problem??
With Best Regards,
A.Ilamparithi
|
|
|
|
|
At a guess, it looks like the directory name is being interpreted as an IP address. You may need to prepend additional information ro fully qualify the actual location of the directory.
e.g.
"C:\192.168.1.133"
Roger Allen - Sonork 100.10016
Roger Wright: Remember to buckle up, please, and encourage your friends to do the same. It's not just about saving your life, but saving the quality of life for those you may leave behind...
|
|
|
|