|
All,
I'm using a WebBrowser control in my dialog app, and was just wondering if there's some way of removing the border of the control, and in essence getting rid of that sunken look. Ideally I'd like the background of the control to integrate seamlessly with the background of it's parent dialog box, so there's no visual difference between control and dialog.
I think I might have to override the Create() function...
Any help would be appreciated,
Ritcho
|
|
|
|
|
This is supposed to work but doesn't for me. If you find out how please let me know.
HRESULT CDocHostHtmlView::OnGetHostInfo(DOCHOSTUIINFO * pInfo)
{
pInfo->dwFlags = DOCHOSTUIFLAG_NO3DBORDER;
pInfo->dwDoubleClick = DOCHOSTUIDBLCLK_DEFAULT;
return S_OK;
}
Neville Franks, Author of ED for Windows www.getsoft.com and coming soon: Surfulater www.surfulater.com
|
|
|
|
|
Hi All,
CString csRegHrs;
csRegHrs.Empty();
The next line produces the correct value Say 1000 (for 10.00) in csRegHrs.
csRegHrs = fcvt(m_pDSet->m_REGHRS,2,&decimal,&sign);
Can anyone explain to me why this isn't working.
csRegHrs.Format("%0.2lf");
The above line produces 0.00? Instead it should be 10.00?
I have stepped through the code and when I step into the csRegHrs.Format portion of the code it indicates in red text that it is 0.00 instead of 10.00.
I just don't get it. Any help would be appreciated.
Thanks,
Charlie
Everything is Free Until You Have to Pay for it...
Platforms Windows 2000/XP Professional using Visual C++ 6.0
|
|
|
|
|
Charlie Curtis wrote:
Can anyone explain to me why this isn't working.
csRegHrs.Format("%0.2lf");
The above line produces 0.00? Instead it should be 10.00?
Given that the second parameter to Format() is missing, why would you expect it to work?
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
Thanks for pointing that out. It is usually the simple ones that get you every time... I have put in the second parameter and it is now working fine.
Thanks
Charlie
Everything is Free Until You Have to Pay for it...
Platforms Windows 2000/XP Professional using Visual C++ 6.0
|
|
|
|
|
I can't compile the following code:
class Foo
{
public:
template< class T > void F() { T t; }
};
void main()
{
Foo tmp;
tmp.F < bool >();
}
The compile raises the error:
<br />
_samples.cpp(10) : error C2275: 'bool' : illegal use of this type as an expression<br />
_samples.cpp(0) : see declaration of 'bool'<br />
It raises the same error if I replace the bool type by a class.
It works if F is not declared as a member function.
It also works fine like this:
class Foo
{
public:
template<class T> void F(T bool) { T t; }
};
void main()
{
Foo tmp;
tmp.F(true);
}
How to do the call to have this working without having the type in param???
|
|
|
|
|
You have to declare the class as a template class.
template <class T> class foo
{
void F (T var) { cout << var; }
};
void main()
{
bool b = true;
foo<bool> tmp;
tmp.F(b);
}
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
"Obviously ??? You're definitely a superstar!!!" mYkel - 21 Jun '04
Within you lies the power for good - Use it!
|
|
|
|
|
No, it's not the same purpose.
I really need the template for the member function, not for the class.
It's only for one function, not for the whole class
|
|
|
|
|
class foo
{
template <class T> void F (T var) { cout << var; }
};
void main()
{
bool B = true;
foo Foo;
Foo.F(B);
}
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
"Obviously ??? You're definitely a superstar!!!" mYkel - 21 Jun '04
Within you lies the power for good - Use it!
|
|
|
|
|
Yep, but it's not what I really wanna do
And in this case I prefer doing:
template < class T > void F (T *var) { ... }
and:
Foo.F((bool*)0);
Doing this way, the T object is not construct.
Nonetheless, it's a bit dodgie...
|
|
|
|
|
This is kinda difficult.. I used the following code piece:
class Foo
{
public:
template<typename T> void F() { T var; }
};<DIV>
void main()
{
Foo tmp;
tmp.F<bool>();
} This piece of code compiles properly, but issues a warning about an unreferenced local variable var which is what it should do as well.
Also, the first code piece you posted also compiles properly, but issues the same warning. I am using Visual Studio .NET 2003, so perhaps it's a compiler bug ?
-Antti Keskinen
----------------------------------------------
The definition of impossible is strictly dependant
on what we think is possible.
|
|
|
|
|
I guess it's a compiler issue.. I'm using VC6 sp5
I send this code to one on my friend which got exactly the same problem.
Worst: if you try to change the member function into a static member function, the compiler crashes.
|
|
|
|
|
Kandjar wrote:
template< class T > void F() { T t; }
That is a known problem in VC 6, that arises when the template parameter isn't present in the prototype. The common workaround is:
template< class T > void F(T* unused=NULL) { ... }
--Mike--
Personal stuff:: Ericahist | Homepage
Shareware stuff:: 1ClickPicGrabber | RightClick-Encrypt
CP stuff:: CP SearchBar v2.0.2 | C++ Forum FAQ
----
Martin Kolberg, head of the local animal committee in Telemark, warns people to beware of drunken moose.
If my rhyme was a drug, I'd sell it by the gram.
|
|
|
|
|
I tried, but I'm still unable to do:
tmp.F< bool >();
Am I obliged to do
tmp.F((bool*)0);
to be able to use it?
|
|
|
|
|
I would like my output to be 4 hex digits.
0000 0001 0002 ... 000a 000b ... 0015
I am using the following loop to do this:
<br />
for (int i = 0; i <= 21; i++)<br />
{<br />
cout << setw(5) << hex << i << endl;<br />
}
It currently displays as
0 1 ... a b ... 15
Any help would be appreciated.
S.W.
|
|
|
|
|
printf( "%04x", 255 );
output will be
00FF
so what you want is probably
for( int i = 0; i <= 21; i++ )
{
printf( "%04x\n", i );
}
|
|
|
|
|
Thanks Archer,
Would you mind breaking the statement down for me or maybe you know of a link that would explain it to me. I appreciate your time.
|
|
|
|
|
Keep in mind that cout and printf() are not the same thing. The former is C++ while the later is C.
For a purely C++ solution, you simply need:
cout.fill('0');
cout << setw(5) << hex << i << endl;
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
Personally i prefer to use printf() over cout<<
but thats a matter of personal opinion
i really dont know how to explain printf()
you can look at microsofts description if it makes any sense
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vclib/html/_crt_printf.2c_.wprintf.asp
but what i can do is give you some examples and maby you can pick up on it (note i figured it out from examples)
printf( "This is a %s", "test" );
output: This is a test
printf( "This is 282 in lowercase hex %x", 282 );
output: This is 282 in lowercase hex 11a
printf( "This is 282 in uppercase hex %X", 282 );
output: This is 282 in uppercase hex 11A
printf( "I was born %02d/%02d/%02d", 11, 28, 87 );
output: I was born 11/28/87
|
|
|
|
|
HICON hIcon;
LPBYTE lpBuffer;
hIcon=dlg.GetIconHandle();
lpBuffer=(LPBYTE)::GlobalLock(hIcon);
HANDLE hUpd=BeginUpdateResource("D:\\n.exe",0);
UpdateResource((HMODULE)hUpd,
RT_ICON,MAKEINTRESOURCE(1),
MAKELANGID(LANG_NEUTRAL,
SUBLANG_DEFAULT),
(LPBYTE)lpBuffer,
GlobalSize(hIcon));
EndUpdateResource(hUpd, FALSE);
GlobalUnlock(lpBuffer);
I'm using this code to take the icon from an exe and replace the icon in another exe, but it doesn't work. Every time lpBuffer is empty after GlobalLock. the hIcon handle is retrieved by ExtractIcon();
What am I doing wrong?
Please help!
|
|
|
|
|
I doubt you can do lpBuffer=(LPBYTE)::GlobalLock(hIcon); .
See this MSDN article[^] for more information on icons and resources. It links to a program written in C which has some code you can look at too.
Please note that the structs in the article are wrong. Look at the code in the linked project instead. I believe you will have to fill out an entire ICONDIR, as icons are stored that way (an icon can contain several images). Then the appropriate number of ICONDIRENTRYs and ICONIMAGEs. That's what's supposed to be inside the resource part.
But you are talking about replacing the icon in one exe from another one. I believe you can do the copy without too much work. Just grab a pointer to the icon resource in the source exe, and use it to update the icon entry in the other exe. I think that should work. The linked project has all the details. Good luck
--
Arigato gozaimashida!
|
|
|
|
|
Well this is my problem: How can I grab a pointer from the resource (HICON)??? I was trying to do just that by using GlobalLock().
Do you know any other way to do this???
|
|
|
|
|
Read the MSDN article. It'll tell you what you can do with an HICON (hint: GetIconInfo() and build resource data from that)
--
Arigato gozaimashida!
|
|
|
|
|
If I have the following:
struct Node
{
// various types
} *(*pNode)[7]; // ptr to a 2-dimensional array
===========================
In the ctor I have the following initialization procedure:
for(short i=0; i<7; ++i)
{
*(*(*pNode)+i) = NULL;
}
It doesn't work, and neither does various other efforts.
Later I want to do this:
**pNode = new Node;
(**pNode)->Lvl = 1;
etc.
==============================
If the array is not initialized, no object can be placed in it.
There is a reason why I DON'T want to define the pointer to the array as shown below (or something similar):
*pNode[5][7];
How can I initialized the array using the first example?
Thanks for any insight. I appreciate it.
William
Fortes in fide et opere!
|
|
|
|
|
*(*pNode)[7] is the same as :
Node* (*pNode)[7];
And reads as : a pointer to an array of 7 Node pointers.
Two pointers, two things need to be allocated.
1.
*(*pNode)[7] you have two * and an index [7]
*(*(*pNode)+i) you have three * and an index i
These don't match.
Instead use either :
*((*pNode)+i) = NULL;
or,
(*pNode)[i] = NULL;
2. for( ...
Before you can initialize pNode you have to allocate it. Remember pNode is a 'pointer ...'.
i.e.
pNode = (Node*(*)[7])calloc(7, sizeof(Node*));
Also, by using calloc you don't need to loop to initialize.
3. **pNode = new Node;
What are you trying to do ? pNode is a pointer to an array. Here you only ever access first element.
You likely want to use syntax from 1. i.e. (*pNode)[i] = new Node;
Might be able to help more if you explain the context of its use.
...cmk
Save the whales - collect the whole set
|
|
|
|