|
Interesting! You are right. I am trying to change the style of buttons belong to IDOK and IDCANCEL.
Kuphryn
|
|
|
|
|
Wow. Jeff Partch posted a response at MSDN Newsgroups and mentioned something about "HOWTO: Change or Set the Default Push Button in a Dialog Box." The solution is much more involved than I have anticipated.
Kuphryn
|
|
|
|
|
Okay. Pryrates of CodeGuru posted a solution that works flawlessly. A special thanks to Pryrates for such an elegant solution.
http://www.codeguru.com/forum/showthread.php?s=&threadid=197179
Here is the final code.
-----
void CDialog::SetDefaultBtnOk()
{
DWORD style = m_BtnOk.GetStyle();
// make sure ButtonOK is not already the default button
if ((style & BS_DEFPUSHBUTTON) != 1)
{
style = m_BtnClose.GetStyle();
// remove default push button style
style &= ~BS_DEFPUSHBUTTON;
// set the style
::SendMessage(m_BtnClose.GetSafeHwnd(), BM_SETSTYLE, (WPARAM)style, (LPARAM)TRUE);
// inform the dialog about the new default control id
SendMessage(DM_SETDEFID, m_BtnOk.GetDlgCtrlID());
// get the style
style = m_BtnOk.GetStyle();
// add the default push button style
style |= BS_DEFPUSHBUTTON;
// set the style
::SendMessage(m_BtnOk.GetSafeHwnd(), BM_SETSTYLE, (WPARAM)style, (LPARAM)TRUE);
}
}
-----
The second function SetDefaultBtnClose() is the compliment of the above.
Kuphryn
|
|
|
|
|
Hi i have a CWebBrowser in my dialog,
when i create it the vertical scroll bar is drawn but disabled
how can i make the scollbar disappear altogether and not be shown?
bryce
|
|
|
|
|
At a guess you could call
ShowScrollBar(SB_VERT, FALSE) ;
On the CWebBrowser object.
Roger Allen
Sonork 100.10016
If I had a quote, it would be a very good one.
|
|
|
|
|
I am developing an application that will gather much data from the user, thrash about on the data, then build a document to be printed. I have a copy of the approved document as a MS-Word file, but will not be saving the document, so I can print it anyway I please, so long as the layout is the same. My question: what's the best and/or easiest way to do this? I am guaranteed that all target machines will have Word on them, as well as any other software I require (I'd prefer to have a low-budget solution).
Thanks,
Glenn
|
|
|
|
|
Glenn E. Lanier II wrote:
what's the best and/or easiest way to do this?
1. Create a temp filename (tmpfile or whatever you like).
2. Save the file under that name.
3. ShellExec (I believe could do it) with "winword.exe /p" "filename". Check the registry how it prints a MS Word document. You could probably go fancy by using COM and crap also, but why pay that penalty...
|
|
|
|
|
Thanks, but what I'm really trying to determine is the best way to modify the document programatically.
|
|
|
|
|
Glenn E. Lanier II wrote:
Thanks, but what I'm really trying to determine is the best way to modify the document programatically.
AFAIK the only way you can do this (using MS Word's "remote control" facility) is by using its COM interface.
Take note that you'll get one helluva large header file, including a function that takes 31 (!) parameters, and none of'em have default values.
Enjoy! :->
|
|
|
|
|
Can anyone tell me the difference between Direct3D and OpenGL, in short.
What's the fastest?
The most stabile?
...
and what's your experience with those two api's.
tnx.
|
|
|
|
|
Direct3D uses custom drawing structures called Surfaces which can be locked down for exclusive drawing, whereas OpenGL uses the Device Context (DC) for its drawing surfaces. Advantages of OpenGL is that it is probably more familiar (easier to learn) to experienced C++ programmers who are starting out with these API's, the code is more portable and the result will work on practically any system (provided it was compiled for that system). Advantages of Direct3D (therefore disadvantages of OpenGL) are that their surface implementation is supposedly faster, it is designed and dedicated to Microsoft based systems (why use something more general when you can use something that really takes advantage of Windows? methodology) and all Microsoft X-Box games are made using Direct3D (what a surprise) and have you seen how amazing they look? All in all this question is not an easy one, OpenGL USED to be THE platform to learn, but Microsofts more recent Direct3D API's really do give it a run for its money. You will find hardcore fanatics of both, but personally I find Direct3D a little fiddly and annoying, though I tend to use it more for some reason ???(probably because I develop for windows).
Alan.
"When I left you I was but the learner, now I am the master" - Darth Vader
|
|
|
|
|
Can anyone tell me the difference between Direct3D and OpenGL, in short.
Probably not. This has been an issue of many discussions, but what has emerged AFAIK is that your OpenGL knowledge still counts in five years from now. What you know about D3D now will most certainly be obsolete in a very short time (judging by the rate MS drops "obsolete technology" as they call their badly designed stuff).
OpenGL was designed by people that knew 3D gfx. Let's see someone accuse MS of the same knowledge.
What's the fastest?
In terms of FPS on Windows? Usually D3D (unless you need multiple 3D views in case D3D's limits can bite you quite badly). For any other case the answer is obvious.
The most stabile?
OpenGL. No dubt about it!
OpenGL has been around for over a decade now. D3D has been around, what, 2-3 years? And during those years the API has changed how many times? 2? 3? More? :->
|
|
|
|
|
Why not directly programming with one abstraction higher: NVidia has release a new language called Cg, "C for Graphics", it :looks like ainsi C but with new types and functions and a redesigned main loop.
When programming in Cg, you should be able to compile for OpenGL, D3D and XBox by changing a line of code. I think.
Cheers,
Jonathan de Halleux, Belgium.
|
|
|
|
|
Does anyone know if VC++ 6 supports member templates?
Dave
|
|
|
|
|
Seems to...well, to an extent:
class Test
{
int x_;
public:
Test() : x_(0) {}
template<typename t="">
set(T t)
{
x_ = sizeof(T);
}
};
{
Test t;
t.set(int(3)); // OK
t.set(4.0); // OK
t.set<short>(4); // Compile error
}
i.e. explicit instantiation doesn't work - think it should do, as it does for non-member function templates.
Hope this helps.
Stuart Dootson
'Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p'
|
|
|
|
|
i want to open the My Computer's "Properties" dialog and then select "Hardware" tab on button press event of my application.
anyone knows???
|
|
|
|
|
Try:
PROCESS_INFORMATION pi;
STARTUPINFO si;
memset((void *)&si, 0, sizeof(STARTUPINFO));
memset((void *)&pi, 0, sizeof(PROCESS_INFORMATION));
si.cb = sizeof(STARTUPINFO);
TCHAR szCommandLine[]=TEXT("rundll32.exe shell32.dll,Control_RunDLL Sysdm.cpl @2");
BOOL bFlag = ::CreateProcess(
NULL,
szCommandLine,
NULL,
NULL,
FALSE,
NORMAL_PRIORITY_CLASS,
NULL,
NULL,
&si,
&pi);
Cheers
|
|
|
|
|
I'm sorry.
The command line should be
TCHAR szCommandLine[]=TEXT("rundll32.exe shell32.dll,Control_RunDLL Sysdm.cpl,,2");
|
|
|
|
|
Thanks alot for solving my problem.it really work fine.(can u tell me its portion where "Hardware tab" is selected)?
|
|
|
|
|
TCHAR szCommandLine[]=TEXT("rundll32.exe shell32.dll,Control_RunDLL Sysdm.cpl,,2");
just in ",,2"
",,2" means you want to select the 3rd tab,it is 0 based
Cheers
|
|
|
|
|
// get data from wherever
unsigned char* buf = get_datafromserver();
vector<unsigned char> vbuffer;
// i want to copy the data from the buffer into the vector here
What is the most efficient way to do this?
Thank you
Thomas
modified 29-Aug-18 21:01pm.
|
|
|
|
|
if you know the length of the data in buf (lets call it bufLen, for arguments sake):
vbuffer.reserve(bufLen);
std::copy(buf, buf + bufLen, std::back_inserter(vbuffer));
Stuart Dootson
'Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p'
|
|
|
|
|
I strongly doubt this is the most efficient way to do the copying, since the back inserter must check for overflow every time it is incremented (altough overflow won't happen, but this is something you and me know, not the program.) A speedier way is as follows:
vbuffer.resize(bufLen);
memcpy(&vbuffer[0],buf,bufLen);
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Thank you. sounds great
Thomas
modified 29-Aug-18 21:01pm.
|
|
|
|
|
You want to turn the string into a vector of chars ? Why not use std::string instead ? It's true vector<char> is sometimes a better choice, I'm just curious if you're aware that std::string is an option, and you get the constructor for free.
Otherwise, I'd guess you need to step through buf, calling push_back for each char. As someone else has pointed out, std::copy will do this for you, but it's no more efficient than doing it yourself ( efficiency being what you asked for ). It's obviously neater tho.
Christian
I am completely intolerant of stupidity. Stupidity is, of course, anything that doesn't conform to my way of thinking. - Jamie Hale - 29/05/2002
I have given you two days - please could you let me have the details of your attorney and pastor. - Alex - 01/06/2002
|
|
|
|