|
You've declared pFlyOutMenu to be an array of CMenu 's, not an array of pointers to CMenu 's, hence:
CMenu* pFlyOutMenu = new CMenu[sizeSub];
for (int i = 0; i < sizeSub; i++)
{
pFlyOutMenu[i].CreatePopupMenu();
pFlyOutMenu[i].AppendMenu
etc
}
Software Zen: delete this;
|
|
|
|
|
Yikes! Shows you how inexperienced I am.......many thanks...I see my mistake now.
Appreciate your help,
ns
|
|
|
|
|
Hi all;
I'm using the CShellList class in a project I'm working on. I need to fill up a CComboBoxEx (as well as a CListCtrl) with what is normally seen in the drop-down of a CFileDialog, i.e., My Documents, Desktop, Network Neighborhood, etc. CShellList has calls to get the correct icon depending on the file extension, and it has calls to fill up an image list with the system icons [AttachSystemImageList()], but the position of a particular icon (say, Desktop) in this image list is variable. CShellList also has a GetImageListIcon(CString) which will retrieve the correct icon when passed "C:\\My Documents\\"; but I do not know what string to pass it (if one exists) that will get me the icons for the Desktop, Network Neighborhood, etc. I need to either a.) know what strings to pass it to retrieve the correct system icon, or b.) know how to detect what a particular icon in the image list filled by AttachSystemImageList() relates to. Any help would be greatly appreciated.
Thanks,
Thomas
|
|
|
|
|
Is it possible for an exe file that is running to open the same exe file and append data to it.
Thanks
|
|
|
|
|
I don't believe that this is possible, in a simple context. Rather you have to go about and copy the executable to some new file, append the data to the new file, and then write some special keys in the registry such that the next time Windows starts up, the original file is deleted and then the copy is renamed.
Chris Meech
"what makes CP different is the people and sense of community, things people will only discover if they join up and join in." Christian Graus Nov 14, 2002.
"AAAAAAAAAHHHHHH!!!!! Those leaks are driving me crazy! How does one finds a memory leak in a garbage collected environment ??! Daniel Turini Nov. 2, 2002.
|
|
|
|
|
I am porting some code to be UNICODE compatible and I have run into a few snags, namely that there aren't one to one mappings for all functions to work with UNICODE. There are some that have one to one mappings like atoi -> _ttoi.
I have an atof() function that needs a UNICODE equivlant but there doesn't seem to be anything of the sort. How would one go about simulating this or finding a proper _ttof() like function?
Cheers,
Clint
|
|
|
|
|
look up scanf() and the unicode/tchar version
- Roman -
|
|
|
|
|
clintsinger wrote: I have an atof() function that needs a UNICODE equivlant but there doesn't seem to be anything of the sort.
What about _tcstod() ?
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"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
|
|
|
|
|
I would like to display the standard hand pointer cursor over some buttons that are just images, and don't really look like buttons. I remember hearing that someone was able to read the graphic from some Windows DLL, and then use that as a resource instead of having to create their own. Does anyone have any suggestions on how to do this or could you point me to an article that has this?
Regards,
Brigg Thorp
Software Engineer
Timex Corporation
|
|
|
|
|
No need to read any graphics from a DLL. LoadCursor(hInstance, IDC_HAND) is one way to acquire the hand pointer.
Do you implement these buttons yourself? If so, you could specify the hand pointer when you register the window class. If you don't register a new window class, I guess you could track the mouse cursor movements in and out of the button and use SetCursor appropriately.
--
Eventhough the forrest is full of trees, there's still no tree between the trees.
|
|
|
|
|
Also another note is, set the cursor to be used in the WM_SETCURSOR message handler, not in WM_MOUSEMOVE etc as you get a flickering cursor as it switches between the default and WM_MOUSEMOVE one.
Roger Allen
Sonork 100.10016
This is a multiple choice question, choose wisely
Why did the hedgehog cross the road?
A: To show he had guts?
B: To see his flat mate?
|
|
|
|
|
Wow, you have no idea how simple you made this for me! I had done something like this by subclassing my buttons and using WM_MOUSEMOVE but now everything is much nicer. I am curious though if my subclassing is causing a memory leak:
LRESULT CALLBACK ButtonProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
HCURSOR hCursorRHand = LoadCursor(hInst, MAKEINTRESOURCE(IDC_REDHAND));
switch(message)
{
case WM_SETCURSOR:
SetCursor(hCursorRHand);
return TRUE;
}
return CallWindowProc(DefButtonProc, hwnd, message, wParam, lParam);
}
The fact that I am calling LoadCursor and no DestroyCursor is that causing a leak because MSDN says there is no need to call DestroyCursor (or at least this is how I interpreted it). If it is causing a leak, where would I put DestroyCursor in this function?
|
|
|
|
|
You probably do have a resource leak in your code. You need to do LoadCursor() just the once and store the handle somewhere to re-use, as it is your leaking 1 cursor resource everytime the procedure is called.
I had some code a while back that was leaking icons, the results were very bad after a short period of time.
Roger Allen
Sonork 100.10016
WHats brown and sticky?
A stick or some smelly stuff!
|
|
|
|
|
I am confused on the matter actually, MSDN states that LoadCursor will not load the cursor if it has already been loaded but that sounds fishy to me. I was also thinking to call DestroyCursor just before the function returns. I think that would probably take care of every LoadCursor call wouldn't it?
|
|
|
|
|
hi, my quiestion is not related to VC++ programming.so forgiveme
my problem is i download some *.ps file. how can i open this file. i searched the google and i fooundout tha ps=post script. but i didn't find any utiliti to open this file.
it seems that ps is related to Some king of Printing files, plzz help meeee
thanx
|
|
|
|
|
http://www.cs.wisc.edu/~ghost
Regards,
Martin
--------------------------------------------
C'mon we all know computers are experimental devices and should only be used for playing games.
Using them for alternative stuff like business, is clearly not using them for what they are intended.
Colin Davies
|
|
|
|
|
I have seen source code on creating region information from BMP's by making one color transparent.
Is there any code available which can create regions to be used in skins from transparent png etc files.
In my dream, I was dorwning my §orrow§
But my §orrow§, they learned to §wim
|
|
|
|
|
Hi guys,
I have a MDI App without doc/view. The App start with 4 child windows open in Cascade. I would like them to open with "Tile" Style. How can I do that?
Thanks.
|
|
|
|
|
::TileWindows
Gary Kirkham
A working Program is one that has only unobserved bugs
I thought I wanted a career, turns out I just wanted paychecks
|
|
|
|
|
Thanks!! That's what I needed.
|
|
|
|
|
Hello all. I'd like to use something that approximates a Class Specific #define without using namespaces, static const's or enums. Actually enums in the class would be good except some of the defines are floating point numbers.
1 header file has #define MAX_LASER_POWER 23.3, another has #define MAX_LASER_POWER 44.0
Anybody have a clever way to elegantly encapsolate these defines?
Thanks in advance!
|
|
|
|
|
Well, you could try this:
class A
{
public:
static const double MAX_LASER_POWER;
};
[EDIT] Oops, I forgot the "const".
const double A::MAX_LASER_POWER = 23.3;
class B
{
public:
static const double MAX_LASER_POWER;
};
[EDIT] Oops, I forgot the "const".
const double B::MAX_LASER_POWER = 44.0;
You will get basically the same results as using a #define since they are const.
Chris Richardson
Programmers find all sorts of ingenious ways to screw ourselves over. - Tim Smith
|
|
|
|
|
I want to write an SNMP extension agent for one of my applications, that run on a Windows 2000 server.
How do i return an array of values in a GET or GETNEXT request?
I made an MIB that looks like this:
What does the extension agent say when it gets a request for
enterprises.radical.software.apps.radicalserver.radicalserverinstance.serverconnections
since it actually points to a list of connection objects
Also how is the members of the connections array accessed. Is it like
enterprises.radical.software.apps.radicalserver.radicalserverinstance.serverconnections.0
enterprises.radical.software.apps.radicalserver.radicalserverinstance.serverconnections.1
etc....
RADICALSERVER-MIB DEFINITIONS ::= BEGIN
IMPORTS
enterprises
FROM RFC1155-SMI
OBJECT-TYPE
FROM RFC-1212
DisplayString
FROM RFC-1213;
radical OBJECT IDENTIFIER ::= { enterprises 15812 }
software OBJECT IDENTIFIER ::= { radical 1 }
apps OBJECT IDENTIFIER ::= { software 1 }
radicalserver OBJECT IDENTIFIER ::= { apps 1 }
radicalserverinstance OBJECT_TYPE
SYNTAX RadicalServerInstance
ACCESS not-accessible
STATUS mandatory
DESCRIPTION "Radical Server Instance"
::= { radicalserver 1 }
RadicalServerInstance ::=
SEQUENCE
{
serverstatus INTEGER,
serverinstancename DisplayString,
serverinstancetype DisplayString,
serverincomingmsgs INTEGER,
serveroutgoingmsgs INTEGER,
serverconnectcount INTEGER
}
serverstatus OBJECT-TYPE
SYNTAX INTEGER
ACCESS read-only
STATUS mandatory
DESCRIPTION "The Status of the server 1 - up, 0 - down"
::= { radicalserverinstance 1 }
serverinstancename OBJECT-TYPE
SYNTAX DisplayString
ACCESS read-only
STATUS mandatory
DESCRIPTION "The name of the instance"
::= { radicalserverinstance 2 }
serverinstancetype OBJECT-TYPE
SYNTAX DisplayString
ACCESS read-only
STATUS mandatory
DESCRIPTION "The type of the instance"
::= { radicalserverinstance 3 }
serverincomingmsgs OBJECT-TYPE
SYNTAX INTEGER
ACCESS read-only
STATUS mandatory
DESCRIPTION "No. of incoming messages per second"
::= { radicalserverinstance 4 }
serveroutgoingmsgs OBJECT-TYPE
SYNTAX INTEGER
ACCESS read-only
STATUS mandatory
DESCRIPTION "No. of outgoing messages per second"
::= { radicalserverinstance 5 }
serverconnectcount OBJECT-TYPE
SYNTAX INTEGER
ACCESS read-only
STATUS mandatory
DESCRIPTION "No. of outgoing messages per second"
::= { radicalserverinstance 6 }
serverconnections OBJECT-TYPE
SYNTAX SEQUENCE OF serverconnection
ACCESS not-accessible
STATUS mandatory
DESCRIPTION "Connection list on the server instance"
::= { radicalserverinstance 7 }
serverconnection OBJECT-TYPE
SYNTAX ServerConnection
ACCESS not-accessible
STATUS mandatory
DESCRIPTION "Connection on the server instance"
::= { serverconnections 1 }
ServerConnection ::=
{
serverconnectionid DisplayString
serverconnecttype INTEGER
serverconnectstatus INTEGER
serverincomingmsgs INTEGER
sreveroutgoingmsgs INTEGER
}
serverconnectionid OBJECT-TYPE
SYNTAX DisplayString
ACCESS read-only
STATUS mandatory
DESCRIPTION "Identifier of the connection"
::= { serverconnection 1 }
serverconnecttype OBJECT-TYPE
SYNTAX INTEGER
ACCESS read-only
STATUS mandatory
DESCRIPTION "Type Incoming = 0, Outgoing = 1"
::= { serverconnection 2 }
serverconnectstatus OBJECT-TYPE
SYNTAX INTEGER
ACCESS read-only
STATUS mandatory
DESCRIPTION "disconnected = 0, connected = 1"
::= { serverconnection 3 }
serverincomingmsgs OBJECT-TYPE
SYNTAX INTEGER
ACCESS read-only
STATUS mandatory
DESCRIPTION "No of incoming messages per second"
::= { serverconnection 4 }
serveroutgoingmsgs OBJECT-TYPE
SYNTAX INTEGER
ACCESS read-only
STATUS mandatory
DESCRIPTION "No of outgoing messages per second"
::= { serverconnection 5 }
----------------------------------------------------------------
END
Any help is greatly appreciated. I am a beginner in SNMP.
My article on a reference-counted smart pointer that supports polymorphic objects and raw pointers
modified 29-Aug-18 21:01pm.
|
|
|
|
|
I have some code that does great:
CMenu* mmenu = ((CMainFrame*)AfxGetMainWnd())->GetMenu();
int pos = ((CMainFrame*)AfxGetMainWnd())->FindMenuItem(mmenu, "test dyn");
CMenu* submenu = mmenu->GetSubMenu(pos);
pos = ((CMainFrame*)AfxGetMainWnd())->FindMenuItem(submenu, "junk");
CMenu * flyOutMenu;
flyOutMenu->CreatePopupMenu();
<code>flyOutMenu->AppendMenu(MF_STRING, 0, "From View 1 butto");
pos = ((CMainFrame*)AfxGetMainWnd())->FindMenuItem(submenu, "junk");
submenu->ModifyMenu(pos,MF_BYPOSITION|MF_POPUP,(int)(flyOutMenu->m_hMenu),"&File");
submenu->AppendMenu(MF_POPUP,(int)(flyOutMenu->m_hMenu),"&File1");</code>
Now if I replace the section in red by the foll. it crashes at flyOutMenu->CreatePopupMenu(); !!!!! It doesnt even get to the replacement code. What have I done wrong?
CBKDoc * pDoc = (CBKDoc *)GetDocument();
DynaMenuMap::iterator itDyn = (pDoc->dynaMenuMap).begin();
for (; itDyn != (pDoc->dynaMenuMap).end(); itDyn++)
{
char * tempDyn;
CString tempCDyn = (*itDyn).first;
tempDyn = new char [tempCDyn.GetLength() + 1];
strcpy(tempDyn, tempCDyn);
SubMenuSet& subMenuSet = (pDoc->dynaMenuMap)[tempCDyn];
SubMenuSet::iterator itSub = subMenuSet.begin();
for (; itSub != subMenuSet.end(); itSub++)
{
char * tempSub;
CString tempCSub = *itSub;
tempSub = new char [tempCSub.GetLength() + 1];
strcpy(tempSub, tempCSub);
flyOutMenu->AppendMenu(MF_STRING, 0, tempSub);
delete tempSub;
}
if ( itDyn == pDoc->dynaMenuMap.begin())
{
submenu->ModifyMenu(pos,MF_BYPOSITION|MF_POPUP,(int)(flyOutMenu->m_hMenu),tempDyn);
}
else
{
submenu->AppendMenu(MF_POPUP,(int)(flyOutMenu->m_hMenu),tempDyn);
}
}
Appreciate your help,
ns
|
|
|
|
|
I'm pretty darn sure this is not good:
<br />
CMenu * flyOutMenu; <br />
flyOutMenu->CreatePopupMenu();<br />
since "flyOutMenu" is a pointer that is uninitialized . To fix, rename variable to "pFlyOutMenu" to indicate and remind you it is a pointer ... and change code to:
<br />
CMenu * pFlyOutMenu = new CMenu; <br />
if (pFlyOutMenu)<br />
{<br />
pFlyOutMenu->CreatePopupMenu();<br />
:<br />
:<br />
:<br />
pFlyOutMenu->DestroyMenu();<br />
delete pFlyOutMenu;<br />
}<br />
I could be wrong of course......
|
|
|
|