|
Hello,
Does anyone have any pointers to articles about making a multi-line list control? I've searched here and cannot seem to find this specific issue.
thanks! JennyP
|
|
|
|
|
I've written one, but that was for work, so I can't post code.
As I recall, I handled WM_MEASUREITEM to reflect the number of lines I wanted, then handled either NM_CUSTOMDRAW or WM_PAINT to paint the text (I can't recall). This was on Windows CE, so you might need to do things differently. This technique only works if all items are the same height, though - that is, they have the same number of lines.
|
|
|
|
|
What is the best way to open a image file and get
access to the raw bytes of the image so that I can
apply various algorithms from Intel's IPP library.
Also what about allocating the wright ammout of memory?
Can I just use GetFileSize or the like to get the required
size of the buffer?
Thank You
Bo Hunter
|
|
|
|
|
depends on what kind of image you want to load...
loading a BMP file is really easy, you have to read the header, allocate memory for the bitmap and read the rest of the file.
Don't try it, just do it!
|
|
|
|
|
I want to write an application that knows when it is closed from the Task Manager and it can prevent it from happening
|
|
|
|
|
having viral thought or what?;P
check this out (im not sure about this):
use CreateThread() and check out the security descriptors; maybe these things are useful.
|
|
|
|
|
Hiii,
I want to control the individual pins of Serial port using VC++. I need to retrieve Data, Read/Write enable and Software driven Clock from it.
I've checked "Hardware Interface Programming in VC++ - Part I (Port Access) By Jaygiri". It's really good.
Waiting for the artical controlling Serial Port.
Plzzzzzzzzz reply as soon as possible.
|
|
|
|
|
see if this help
http://www.codeproject.com/system/serial.asp
for toggling pin, you may check handshaking stuffs and SetCommState api.
regards,
jim
|
|
|
|
|
Hiii,
I cannot use SetCommState as I don't want to set the baud rate of the port.
I don't want to use RS-232 protocol.
I think it can be done using _inp() n _outp() functions but don't know how. Help required.....
Plzzzzzzzzzzzzzz send reply as soon as possible.
Thanks in advance.
|
|
|
|
|
Hello all,
I'm having difficulties to get the string of a menu item pressed.
What I'm doing is writing a IE toolbar and in one of the pull down menu's I dynamically add popup menu's which are also dynamically filled.
Just for a theoretical example let's say I have a button 'drives' on the toolbar. Pressing the pulldown menu will add some menu entries (the same amount of disk on my system, C; D; E; ...).
Every menu item is a popup itself, and a dynamically created Popupmenu is attached - containing the root level directories for the selected drive (temp, program files, winnt, ...).
Following is an adapted piece of code, but it works how it suppose to
<br />
MENUITEMINFO mmi;<br />
mmi.cbSize=sizeof(MENUITEMINFO);<br />
mmi.fMask=MIIM_STRING | MIIM_DATA | MIIM_SUBMENU;<br />
<br />
char fn[50];<br />
<br />
for (int i=0; i<3; i++)<br />
{<br />
HMENU hMenuToInsert;<br />
hMenuToInsert = CreatePopupMenu();<br />
{<br />
char drv[255];<br />
while (getthedrives)<br />
{<br />
sprintf( drv, "%s", a_directory);<br />
AppendMenu(hMenuToInsert, MF_ENABLED|MF_STRING, ID_DUMMY, drv);<br />
}<br />
}<br />
sprintf( fn, "Drive %s", drvletter);<br />
mmi.hSubMenu = hMenuToInsert;<br />
mmi.dwTypeData = fn;<br />
mmi.fType=MFT_STRING;<br />
InsertMenuItem(m_hDriveMenu, 2+i, TRUE, &mmi);<br />
<br />
}<br />
The problem I'm having is, is that I'm using a dummy ID (ID_DUMMY).
When my ON_COMMAND fires, I have no way to get the correct menu item using GetMenuItemInfo because
a) I'm using the same id for every popup menuitem inserted
b) I'm reusing the HMENU (hMenuToInsert) for my popmenu's
Does anyone know of a simple way to get the text of the menu (directorys on a drive in my case) pressed?
Thanks
Wim
|
|
|
|
|
|
Hi Michael,
I'm reusing them because I really have no clue how many directories I will have.
Let's say I have 10.000 directories, that means I have to define 10.000 unique id's. You know of a way to create that many on the fly, or maybe a better way to do it?
The other problem I have then is to what popupmenu the directory I clicked belongs (C:, D:, E , but I supppose I can have a list of HMENU id's and I check every list/MENU_ID for success.
Thanks
Wim
|
|
|
|
|
Well, command IDs can be in the range 1-65535. Just start a counter a 1 and increment it for every menu item you add. Each menu under the first level can use 1-65535, you don't need a unique ID for every single item if you think you'd ever have more than 65535. You can tell which top-level popup has been selected by handling WM_MENUSELECT , and from there you can work out which directory was selected.
You should also give the top-level popups IDs for easier tracking (and those IDs shouldn't be duplicated in the submenus). You can do this with InsertMenuItem() .
--Mike--
Ericahist | CP SearchBar v2.0.2 | Homepage | 1ClickPicGrabber New v2.0.1! | RightClick-Encrypt
There is a saying in statistics that a million monkeys pounding on typewriters would eventually create a work of Shakespeare. Thanks to the Internet, we now know that this is not true.
|
|
|
|
|
Ok,
I see it now. One thing what I discovered when playing with the WM_MENUSELECT was that I couldn't get the (a random) text from my popup menu (just for a test, take the first entry of the popupmenu, I will move it to the WM_COMMAND later).
What I did was this:
<br />
LRESULT CMyToolBar::OnMenuSelect(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)<br />
{<br />
if (lParam&&(HIWORD(wParam)&MF_POPUP))<br />
{<br />
HMENU hSubMenu = GetSubMenu ( (HMENU)lParam, LOWORD(wParam));<br />
<br />
MENUITEMINFO mii;<br />
mii.fMask = MIIM_STRING;<br />
<br />
char c[2000];<br />
mii.dwTypeData=c;<br />
mii.cch=2000;<br />
<br />
GetMenuItemInfo(hSubMenu, 0, TRUE, &mii);<br />
MessageBox(mii.dwTypeData);<br />
}<br />
return 0;<br />
}<br />
According to the documentation, lParam contains the Handle to the menu I pressed (the main menu), and if HIWORD(wParam) contains flag MF_POPUP, the LOWORD(wParam) contains the the position pressed in the menu.
If I use GetSubMenu((HMENU)lParam, HIWORD(wParam)), I should get the handle to my popupmenu containing the directories, right?
I outputted the parameters, and the handle and index looked OK.
But when I used GetMenuItemInfo using the handle obtained with GetSubMenu and index 0 (the first Item in the popup menu), it returns an empty string.
Any idea what I'm doing wrong?
Thanks
Wim
|
|
|
|
|
Michael,
Just wanted to thank you again for your excellent answer. Got it working now.
Regards
Wim
|
|
|
|
|
If one has an app with a tray icon and menu, is there a way to create a graphic to the left side of the popup menu? It would run the complete vertical length of the menu.
Best Wishes,
ez_way
|
|
|
|
|
|
Hi, I wrote an application which connects via an HTTP proxy. Can I get the default proxy from the system (hostname and port)? Alternatively can I get it from IE?
|
|
|
|
|
Hi,
There is not such a thing as the system proxy. WinINet functions are tied to IE, and it is IE settings that you can get and set with this library. Take a look at InternetQueryOption documentation.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Cheers, I'll try... following what I have found
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wininet/wininet/internetqueryoption.asp
http://support.microsoft.com/default.aspx?scid=http://support.microsoft.com:80/support/kb/articles/q226/4/73.asp&NoWebContent=1
|
|
|
|
|
Hi!
I need to convert a TCHAR* string (which actually can be a char* or wchar_t* string) to UTF-8 format and the other way round.
I cannot use the MultiByteToWideChar and WideCharToMultiByte functions.
Is there a small, tiny library that does this? I've had a look at IBM's ICU, but this library does much too much, I don't need all those additional conversion functions, etc.
Or is there perhaps a simple method how I can do the conversion myself?
Thanks in advance!
Dominik
_outp(0x64, 0xAD);
and
__asm mov al, 0xAD __asm out 0x64, al
do the same... but what do they do??
(doesn't work on NT)
|
|
|
|
|
I dunno how allergic you are to the LGPL license, but here's one library which can do the transformation for you: http://www.gnu.org/software/libiconv/[^]
--
Seraphim Shock. Gold for your ears.
|
|
|
|
|
Hey all.
I have read a couple of articles on this site (and others) that I thought would help out, but was not exactly what I was looking for.
I have modified the default "MFC" icon in my app to put my own in there. I compile and run it, all is fine, it shows up correctly.
However, when I am looking at files with Explorer, the file shows up with the MFC icon! It shows up with the MFC icon, then the program name, and then "TODO: <file description="">" ... I figured out where I put in the description, company name and all that good stuff, but I can not figure out how to make it use the icon that I created that gets displayed on the taskbar when the program runs. Any suggestions?
Thanks
|
|
|
|
|
the icons have different sizes for different display contexts
make sure u edit the 16x16 icon too
"there is no spoon" biz stuff about me
|
|
|
|
|
If I open up my project , under "Icon" there is only one. IDR_MAINFRAME and under appearance it says "32x32". I've looked all through the resources and do not have a 16x16 or any other icon in there.
Do I have to add a new ICON and make it 16x16? If so, how would I then tell the program to use it?
Thank You
|
|
|
|