|
Are there anybody have experience about this problem? CMenu::GetMenuItemInfo always returns 0 in WinNT and GetLastError() returns 87 which means "The parameter is incorrect." This never happened in other platforms. Drop me your advice to fix this. Thanks so much.
|
|
|
|
|
Tuan Dang wrote:
Drop me your advice to fix this.
Without seeing how you are using the function, no advice can be given.
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
Without seeing code, my guess is you aren't initializing the cbSize member of your MENUITEMINFO struct.
--Mike--
Personal stuff:: Ericahist | Homepage
Shareware stuff:: 1ClickPicGrabber | RightClick-Encrypt
CP stuff:: CP SearchBar v2.0.2 | C++ Forum FAQ
----
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.
Actual sign at the laundromat I go to: "No tinting or dying."
|
|
|
|
|
Some lines of simple code:
MENUITEMINFO mmi, temp;<br />
ZeroMemory(&mmi,sizeof(mmi));<br />
mmi.cbSize = sizeof(mmi);<br />
mmi.fMask = MIIM_DATA;<br />
mmi.dwItemData = (DWORD) pData;<br />
::SetMenuItemInfo(pMenu->m_hMenu, nPos, TRUE, &mmi);<br />
temp.cbSize = sizeof(MENUITEMINFO);<br />
temp.fMask = MIIM_DATA;<br />
BOOL rc = ::GetMenuItemInfo(pMenu->m_hMenu, nPos, TRUE, &temp);<br />
if (!rc) {<br />
int iErrCode = GetLastError();
}
When waiting for your replies, I found that the function GetMenuItemInfo will work properly in WinNT if (cbSize==sizeof(MENUITEMINFO) - 4). I think the problem is somewhere around the WINVER. In WinUser.h I saw these:
typedef struct tagMENUITEMINFOW<br />
{<br />
UINT cbSize;<br />
UINT fMask;<br />
UINT fType;
UINT fState;
UINT wID;
HMENU hSubMenu;
HBITMAP hbmpChecked;
HBITMAP hbmpUnchecked;
ULONG_PTR dwItemData;
LPWSTR dwTypeData;
UINT cch;
#if(WINVER >= 0x0500)<br />
HBITMAP hbmpItem;
#endif<br />
}
So, I think the function GetMenuItemInfo failed in Windows NT because of the size of returned variable LPMENUITEMINFO(&temp). GetMenuItemInfo expected to see the size of returned variable is 44. However, sizeof(MENUITEMINFO) returned 48. In my opinion, this caused the error. Anyway, thanks for your replies.
____
Tuan
|
|
|
|
|
I currently have a c++ client application which communicates with a COM server. This application was set up to allow the programmatic bypassing of declarative security. In other words, the application can read information from the registry that will provide a user, password, domain, authentication level, and impersonation level. This allows the administrator to set up clients to impersonate a single user with the necessary launch and access permissions on the COM server.
Recently, we have created a new .NET client that needs to have the same functionality. Does anyone know how to programmatically bypass declarative security in C#? There appears to be plenty of information on how to set up a .NET client to communicate with an unmanaged c++ COM server, but not much information on how to bypass security, if it's even a possibility.
Thanks!
|
|
|
|
|
Is it possible to easily to convert wchar string to CString without using
sth like L"test".
David
|
|
|
|
|
CString str = _T( "String" );
or
CString str( _T( "String" ) );
Don't try it, just do it!
|
|
|
|
|
How about convert CString to WCHAR easily?
David
|
|
|
|
|
It is easily!
Don't try it, just do it!
|
|
|
|
|
Just assign the wchar_t string to a CString variable. CString has a constructor that takes a LPCWSTR and will do the character set conversion for you if necessary.
--Mike--
Personal stuff:: Ericahist | Homepage
Shareware stuff:: 1ClickPicGrabber | RightClick-Encrypt
CP stuff:: CP SearchBar v2.0.2 | C++ Forum FAQ
----
Windows troubleshooting: Reboot first, ask questions later.
Windows troubleshooting: Reboot first, ask questions later.
Actual sign at the laundromat I go to: "No tinting or dying."
|
|
|
|
|
I have made a custom configuration based on my Release configuration in VS.Net 2003. In this version, I want to have SHOWSERVERDIALOG automatically #defined. I thought I saw it once somewhere in properties, but I can't find it now. My code looks like this and I don't want to have to manually #define SHOWSERVERDIALOG when I make a build for this config.
#ifdef SHOWSERVERDIALOG
strServer = GetProfileString(_T("Settings"),_T("Server"),_T(""));
if(!strServer.GetLength())
{
CServerDlg dlg;
if(dlg.DoModal() == IDOK)
strServer = dlg.m_strServerName;
}
#else
strServer = _T("TITANIC");
#endif
[insert witty comment here]
bdiamond
|
|
|
|
|
I found it. Sorry
[insert witty comment here]
bdiamond
|
|
|
|
|
Hi everybody,
I want to explore more of creating a file database on my own. I can already create a system with fixed-length records in binary format to add, delete and search through it, with file headers and manipulating at the bytes level. Now I would like to find any sources (articles, books, code...) to see how to go about creating a variable fixed records (providing the type of the value that will be stored in the record), how to internally organise the tables, how to link tables, etc...
The purpose of it is to use it in some simple applications to escape the overload of bringing the MDAC, Jet and other componenets into the installation, if I am not going to need any high-performance database, but still wish to have a data storage.
I searched all over the net, but could not find much details about it.
Thanks a lot in advance.
.
|
|
|
|
|
You have two choices, either an index of fixed length records that shows where everything is and how big it is, or start each structure with a field that says how long it is.
I recomend both, that way if something gets corrupt you can use the other to recover most data. If you sprinkle "magic numbers" in there - something that is unlikely to be real data, you can start from any magic number and recover the rest of the file. (this might require someone to manually read the file) You will have to decide how important the data is, and compare that to the increased disk space.
Don't forget to consider checksums to verify the data. Again, something that might not be worth the cost.
|
|
|
|
|
The are a number of compact DBM's around if you don't want to write one yourself. eg. SQLite is very popular.
Neville Franks, Author of ED for Windows www.getsoft.com and coming soon: Surfulater www.surfulater.com
|
|
|
|
|
Just use the dbf format.
The format description is available all over the net as well as source to read/write the files.
...cmk
Save the whales - collect the whole set
|
|
|
|
|
okay guys, thank you very much for your help in this. I will now go to examine some of your thoughts in more details.
Bye.
.
|
|
|
|
|
The issue is:
You are given an array of integers of size n containing values in the range 1 to n-1. Obviously there’s at least one duplicate value in this array. Please let me know the algorithm for finding one such duplicate value.
Thanks.
|
|
|
|
|
Hint: sort the array.
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
Why is it obvious that there's atleast one duplicate value in this array?
ARSALAN MALIK
|
|
|
|
|
Since that the array size is n and the values are from 1 to n-1
|
|
|
|
|
If the array is sorted then use a binary search to check the value at each position against the value of the position :
if ( a[i] == i+1 ) then the duplicate is in the section greater than i
else the duplicate is in the section less than or equal to i.
If the array isn't sorted then allocate a temp array of size n and walk through the original putting 'check marks' in the temp array at the appropriate index (value-1). As soon as you find a value that has alreay been 'checked' you have your duplicate.
...cmk
Save the whales - collect the whole set
|
|
|
|
|
Can anyone tell me if the Application Wizard that exists in Visual Studio 6 is no longer availabe in the new version of Visual Studio? I am so used to working with that wizard and it was such a dissapointment for me not to find it in Visual C++ 2005.
|
|
|
|
|
Visual C++ .NET 2005 has it's own appliation wizard.
Don't try it, just do it!
|
|
|
|
|
In VS.NET 2002 and 2003, it's part of the File|New|Project operation. I would imagine it's in the same place in 2005.
Software Zen: delete this;
|
|
|
|