|
Thanks for your effort but I'm afraid it goes wasted. I totally understood what this is about, As I pointed out before, it's like what new and delete do, only that they're not bothering to define a struct. And, btw., CDLGTEMPLATEEX is probably worse than that, as not only is there no actual definition of that 'struct', some of it's members may be missing entirely! That's what confused me.
I still fail to see why it's better to hack a struct than just use pointers for the dynamic parts. That kind of coding was bad style in times before C++, and it's even worse nowadays. I'd put it on par with using goto , but that might do goto injustice. What we're talking about here is self-modifying data, and I don't see how that is any better than self-modifying code.
The only justification I can think of is some low level code that is really, and I mean REALLY keen to save the extra memory required for the pointer(s). For coding it makes no difference at all. For memory usage, you just need one additional pointer for the dynamically sized part. For efficiency, you only add one level of indirection for resolving access to elements of the dynamic part. In return you get clear data structures that describe what is actually there, remove the need to unsafe type-casting, and get code that is much more readable and maintainable.
IMHO, that MS is still using such techniques is an abomination. And it is no reason to use such techniques yourself.
|
|
|
|
|
It's not about saving the space required by a pointer. It's about the black box. If one could design it all from the beginning, this would never have been discussed. The problem is that one can't change the requirements a black box has. You can't change how Microsoft expects to receive the data for a binary dialog template. You can't redesign the structure.
Why would you want to deal with pointer arithmetics if the compiler can do it for you? Remember that this is about well defined binary representations only. Not data that will change depending on processor architecture or operating system version.
|
|
|
|
|
Niklas Lindquist wrote: If one could design it all from the beginning, this would never have been discussed. My point exactly.
I am aware that you have to deal with it if you want to access MS's interfaces, and I understand why you would provide pseudo-definitions for the structures being used in that case.
But since the OP didn't do that there was no reason to use such a construct in the first place. Hence I suggested using a pointer instead.
|
|
|
|
|
Ok. In retrospect, I was reading more into the OP question than was really there. To me it looked as if it was a binary layout going on, which he later indicated there wasn't.
|
|
|
|
|
No worries. I did ask what such a construct would be good for, so I shouldn't have been surprised to receive an answer, even if it was unrelated to the original problem.
|
|
|
|
|
It works, thanks a million. I knew it was something small (i.e. boneheaded) that I was doing wrong. I guess blinding following some articles on the MSDN can lead you into trouble (since they never give you the big-picture view).
|
|
|
|
|
Hi everybody,I used vc 2008 sp1 and created a dialog app.I used
CMFCVisualManagerOffice2007::SetStyle(CMFCVisualManagerOffice2007::Office2007_LunaBlue);
CMFCVisualManager::SetDefaultManager(RUNTIME_CLASS(CMFCVisualManagerOffice2007));
in CAppEx::InitInstance(),but there were nothing happaned.I wonder thether the dialog app couldn't use CMFCVisualManagerOffice2007 .
Thanx.
|
|
|
|
|
stephen_young wrote: in CAppEx::InitInstance(),but there were nothing happaned.I
I do not think that these styles can be used with dialog apps. To verify, create an SDI app.
"One man's wage rise is another man's price increase." - Harold Wilson
"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
"Man who follows car will be exhausted." - Confucius
|
|
|
|
|
Thanx David.Yes the SDI app is OK!!
|
|
|
|
|
Hi!
Is it possible to MultiLanguage Support Facility(e.g English,Chinese and Korean) with VC++? Can any body point me the direction
|
|
|
|
|
Your VC++ program can support multiple languages if you use Unicode versions of API calls. You can build your project with Unicode settings.
You can check out the book "Advanced Windows" by Jeffrey Richter.
|
|
|
|
|
See the eMule source code.
It supports these threee language.
|
|
|
|
|
Yes It is possible.
1) You have to install supplement language support for other languages. You can check it with Control Panel -> Regional and Language option.
2) Set your project as Unicode not ANSI.
I believe in LOVE AT FIRST SIGHT...
Bcoz I have loved my Mother...
even since I opened my eyes...(ICAN)
|
|
|
|
|
In addition to above answer you can also go there[^] to read thread about same toppic.
|
|
|
|
|
Hi!
I've to implement Remember me facility. i.e My application has a log in Form. In this
log in Form, there are two text boxes(one for entering user name and another one for entering
Pass Word), a check Box(called "Remember Me") and a Button called Log in. If the check box is
checked,When we run the exe at the next time, these two text boxes should be filled by the already entered user name and Password. How to do this in C++?
|
|
|
|
|
You should make persistent your application settings (for instance writing them inside the registry). make sure to crypt the password, then.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
CPallini wrote: for instance writing them inside the registry
Can u elaborate on this?
|
|
|
|
|
You may have a look at one of the many articles about the registry here at CodeProject, see, for instance, Newcomer's A Registry Class[^].
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Hi,
I have a specific problem:
I need to draw a text like "HomeSweet Home" but it should wordwrap and after wrapping It should be displayed as
"HomeSweet
Home"
how can I do that?
|
|
|
|
|
You may use the DT_WORDBREAK format flag (or manually insert a carriage return-linefeed sequence), see DrawText at MSDN[^].
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Hi I am trying to create a TCP/IP port programatically in win32.
Here is my code.
HANDLE hXcv;
PRINTER_DEFAULTS pd = {NULL, NULL, SERVER_ACCESS_ADMINISTER};
TCHAR szBuf[MAX_PATH] ={0};
TCHAR szMsg[512];
DWORD dwLastError;
::lstrcpy(szBuf, TEXT(",XcvMonitor Standard TCP/IP Port"));
if(OpenPrinter(szBuf, &hXcv, &pd) != FALSE )
{
OutputDebugString(TEXT("Hello. It worked....!"));
}
else
{
dwLastError = GetLastError();
wsprintf(szMsg, TEXT("OpenPrinter return error:%d\n"), dwLastError);
OutputDebugString(szMsg);
}
> But the problem is OpenPrinter API failing and returning
error code as 5 (ERROR_ACCESS_DENIED).
> But when I try to create the port manually (print properties), port is created.
> I have logged in as an administrator and I have all permissions.
I am working on Windows Server 2008 R2 Statndard (64 bit OS)
Note: OpenPrinter API working fine if I turn-OFF User Account Settings (UAC). Failing if UAC is ON
Please tell me what's wrong with my code.
Thank you in advance.
Regards
msr
modified on Monday, February 14, 2011 6:29 AM
|
|
|
|
|
There is nothing wrong in your code and also do not turn off UAC. Try to execute you application in admin privileges.
select RequireAdminstration as a property.
For future reference:
Google this keyword "Windows7GATrainingKitForDevelopers.Setup.exe" and run this exe. Its a training kit for developer working on Windows 7. It is awesome.
I believe in LOVE AT FIRST SIGHT...
Bcoz I have loved my Mother...
even since I opened my eyes...(ICAN)
|
|
|
|
|
Hi,
"select RequireAdminstration as a property"
I have not understood the above statement.
Cab you just explain me how to do this?
Regards
msr
|
|
|
|
|
1) Open Project property page
Project->Property or use shortcut key (Alt + f7).
2) Select Linker->Manifest File, There is one property UAC Execution level. select this option as requireAdminstration.
When you do this than your application is self elevated and run under admin privilege.
I believe in LOVE AT FIRST SIGHT...
Bcoz I have loved my Mother...
even since I opened my eyes...(ICAN)
|
|
|
|
|
Hi, thanks for the reply.
But in vs2008 there is no such option (Linker -> Manifest fie)for vc++ win32 projects.
Regards
msr
|
|
|
|