|
Thanks for your reply.
But many feature in stardard C++ are in namespace std. Even the simple input & output, string are in namespace std.
So, should I stick with using::string style? Is it better or it doesn't matter, like what the author said?
-----------------------------
C++ without virtual functions is not OO. Programming with classes but without dynamic binding is called "object based", but not "object oriented".
|
|
|
|
|
My preference is to use individual using std::string; type statements instead of bringing the whole std namespace in with using std;
But of course there is no reason why you have to use using ...; at all. You can just use the full names at the appropriate points. eg
std::cout << "This is a test" << std::endl;
Instead of
using std::cout;<br />
using std::endl;<br />
<br />
cout << "This is a test" << endl;
Mike
|
|
|
|
|
Mike Beckerleg wrote:
You can just use the full names at the appropriate points.
Indeed, I prefer to use the explicit full names. It is then obvious which function you intend to call.
Ant.
I'm hard, yet soft. I'm coloured, yet clear. I'm fruity and sweet. I'm jelly, what am I? Muse on it further, I shall return! - David Walliams (Little Britain)
|
|
|
|
|
Antony M Kancidrowski wrote:
Indeed, I prefer to use the explicit full names. It is then obvious which function you intend to call.
Exactly
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
Is there a way to UNATTENDEDLY lock and unlock a workstation ? Could this be done by MacroScheduler? If I use a C++ programming, what kind of API will do ? I tried keybd_event(), but not work.
lParam = MakelParamValue(0, VK_MENU, 0, 1, 0, 0); // alt key down
keybd_event(VK_MENU, 0, 0, lParam);
lParam = MakelParamValue(0, VK_CONTROL, 0, 1, 0, 0); // Ctrl key down
keybd_event(VK_CONTROL, 0, 0, lParam);
lParam = MakelParamValue(0, VK_DELETE, 0, 1, 0, 0); // Del key down
keybd_event(VK_DELETE, 0, 0, lParam);
//
lParam = MakelParamValue(0, VK_DELETE, 0, 1, 1, 1); // Del key up
keybd_event(VK_DELETE, 0, KEYEVENTF_KEYUP, lParam);
lParam = MakelParamValue(0, VK_CONTROL, 0, 1, 1, 1); // Ctrl key up
keybd_event(VK_CONTROL, 0, KEYEVENTF_KEYUP, lParam);
lParam = MakelParamValue(0, VK_MENU, 0, 0, 1, 1);
keybd_event(VK_MENU, 0, KEYEVENTF_KEYUP, lParam); // alt key up
My email: xueshunnai@hotmail.com or xueshunnai@aol.com
Thanks!
xsn
|
|
|
|
|
|
Everybody, Hi!
How to create property window, Visual Studio.NET like?
Help, Please!
|
|
|
|
|
Hi,
I want to display load and display and image which present in the directory in VC++. I will be using menus, toolbars... Using SDI, we can get toolbars inbuilt and not much of code to be written, but I do not know how to display an Image, as there are no controls to place. Using Dialog based, there is no menus and toolbars.
I wanted to know, which is the better one to do an image processing project and also how to display and image.
Please do help.
Thanks
|
|
|
|
|
you can look for CxImage Libaray Inthis Site,very good S/W for Image Processing
-----------------------------
"I Think It Will Help"
-----------------------------
Alok Gupta
visit me at http://www.thisisalok.tk
|
|
|
|
|
Hi,
I'm having trouble with that function. I have a block representing an RGB image with 8 bits per color value. I wanted to use the function SetDIBitsToDevice to output this image to screen. The problem is that the function returns 0 (error because 0 lines set) and GetLastError() function also returns 0. So I don't know what the problem is. Even if the image I have is screwed up I thought it should output some kind of weird thing to the screen or at least crash.
Here's my code inside OnPaint() function of ChildView:
<br />
CPaintDC dc(this);<br />
BITMAPINFO m_bitmapInfo; <br />
m_bitmapInfo.bmiHeader.biSize = sizeof( BITMAPINFOHEADER );<br />
m_bitmapInfo.bmiHeader.biWidth = m_nOutputWidth;<br />
m_bitmapInfo.bmiHeader.biHeight = -m_nOutputHeight;
m_bitmapInfo.bmiHeader.biPlanes = 1;<br />
m_bitmapInfo.bmiHeader.biBitCount = 32;<br />
m_bitmapInfo.bmiHeader.biCompression = BI_RGB;<br />
m_bitmapInfo.bmiHeader.biSizeImage = ::abs( m_nOutputWidth*m_nOutputHeight ) * 3;<br />
m_bitmapInfo.bmiHeader.biXPelsPerMeter = 100;<br />
m_bitmapInfo.bmiHeader.biYPelsPerMeter = 100;<br />
m_bitmapInfo.bmiHeader.biClrUsed = 0;<br />
m_bitmapInfo.bmiHeader.biClrImportant = 0;<br />
<br />
int val = ::SetDIBitsToDevice(<br />
dc.GetSafeHdc(),<br />
0, <br />
0,<br />
m_bitmapInfo.bmiHeader.biWidth, <br />
m_nOutputHeight,<br />
0, <br />
0,<br />
0, <br />
m_nOutputHeight,<br />
m_pImageData,
&m_bitmapInfo, <br />
DIB_RGB_COLORS );<br />
DWORD err = ::GetLastError();<br />
Thanks for the help.
|
|
|
|
|
I set m_bitmapInfo.bmiHeader.biBitCount = 32;
and the image is 8 bits per pixel. I wish it would have crashed instead of doing nothing and making it hard to debug.
|
|
|
|
|
Blast that was I was going to mension!
I found that the functions that deal with DIBs image data in this fashion tend to fail if the information is not exactly correct WITH OUT generating an error that explanes why it failed.
The GetDIBits() will also fail in the same way WITH OUT an explanation.
I do not know what you are using this for but I would just make the DIB information a member which is updated when that data is changed. That way you will not have to do all that initiation in the OnPaint() function. Of course for a simple application the drawing speed increase would not even be noticable.
INTP
|
|
|
|
|
Hi,
i try to put my small icon in systemtray, for this, i have one icon, IDI_ICON1 with two draws (one with 32x32 and the other with 16x16) but when I use Shell_NotifyIcon(NIM_ADD, IDI_ICON1) the program adapts the 32x32 icon why doesn't use the small icon directly? What I have to do?
Thanks
|
|
|
|
|
test using single icon of 16x16 and add it system tray
-----------------------------
"I Think It Will Help"
-----------------------------
Alok Gupta
visit me at http://www.thisisalok.tk
|
|
|
|
|
I've tried with this too, but it doesn't work. It puts on system tray the transparent icon of 32x32.
|
|
|
|
|
Yeah i tried too,here also it not working properly , i think shell_notifyicon required 32x32 for showing icon at system tray.
-----------------------------
"I Think It Will Help"
-----------------------------
Alok Gupta
visit me at http://www.thisisalok.tk
|
|
|
|
|
Then i'll conform with the big icon
Thanks for help me
|
|
|
|
|
you r always Welcome Brother
-----------------------------
"I Think It Will Help"
-----------------------------
Alok Gupta
visit me at http://www.thisisalok.tk
|
|
|
|
|
Looking at your example you do not have x, y and z in your new struct, just one flag called xyz_offset.
If you want different flags for x, y and z then you need to specify them in your struct.
The the check if (mystruct.x) will work just fine.
Ant.
I'm hard, yet soft. I'm coloured, yet clear. I'm fruity and sweet. I'm jelly, what am I? Muse on it further, I shall return! - David Walliams (Little Britain)
|
|
|
|
|
Yes, your are correct x,y, and z don't exist in the new struct. I only showed the new (actual) struct since you said that my made up struct had a mistake in that the unsigned space: 3;
I had only put a three because that I didn't know where the 16 in the new struct had come from.
|
|
|
|
|
Hi,
I have a problem with function pointers in C++. As example;
class A
{
...
public:
double go(double (A::*f)(double, double));
double callMe(double, double);
void myFunc();
}
...
double A::go(double (A::*f)(double, double))
{
return f(1, 2); // for example
}
double A::callMe(double x, double y)
{
return x+y;
}
void A::myFunc()
{
go(&A::callMe);
}
But the compiler complains that A::f is not a function pointer?? I really can't se why. Any ideas
Thanks guys!
|
|
|
|
|
First off, I need to say that function pointers are yucky and should be avoided whenever possible.
I think the answer is:
double A::go(double (A::*f)(double, double))
{
return (*f)(1, 2); // for example
}
It's something so much nicer done with interfaces...
*sigh*
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<br />
Peter Weyzen<br />
Staff Engineer<br />
<A HREF="http://www.santacruznetworks.com">Santa Cruz Networks</A>
|
|
|
|
|
This is untested, but change
double A::go(double (A::*f)(double, double))
{
return f(1, 2);
} to
double A::go(double (A::*f)(double, double))
{
return (this->*f)(1, 2);
} You can't call a non-static member function without specifying what the this object will be.
--
I'm Michael Dunn and I approve this post.
Vote Trogdor in oh-four!
|
|
|
|
|
I have implemented an instance of IWebBrowser2 in my application and am using IDocHostUIHandler::GetHostInfo(DOCHOSTUIINFO* pInfo) to set various properties of the web browser such as no 3D border (DOCHOSTUIFLAG_NO3DBORDER) and no scroll bars (DOCHOSTUIFLAG_SCROLL_NO). I also wish to disable the running of scripts in my instance of the browser and have attempted to use DOCHOSTUIFLAG_DISABLE_SCRIPT_INACTIVE. The suppression of the 3D border and scroll bars is working perfectly but the suppression of scripts is not working. Here is my implementation of IDocHostUIHandler::GetHostInfo(DOCHOSTUIINFO* pInfo):
HRESULT FAR EXPORT ZBrowser::XDocHostUIHandler::GetHostInfo(DOCHOSTUIINFO* pInfo)
{
/*
DOCHOSTUIFLAG_DIALOG = 0x00000001,
DOCHOSTUIFLAG_DISABLE_HELP_MENU = 0x00000002,
DOCHOSTUIFLAG_NO3DBORDER = 0x00000004,
DOCHOSTUIFLAG_SCROLL_NO = 0x00000008,
DOCHOSTUIFLAG_DISABLE_SCRIPT_INACTIVE = 0x00000010,
DOCHOSTUIFLAG_OPENNEWWIN = 0x00000020,
DOCHOSTUIFLAG_DISABLE_OFFSCREEN = 0x00000040,
DOCHOSTUIFLAG_FLAT_SCROLLBAR = 0x00000080,
DOCHOSTUIFLAG_DIV_BLOCKDEFAULT = 0x00000100,
DOCHOSTUIFLAG_ACTIVATE_CLIENTHIT_ONLY = 0x00000200,
DOCHOSTUIFLAG_OVERRIDEBEHAVIORFACTORY = 0x00000400,
DOCHOSTUIFLAG_CODEPAGELINKEDFONTS = 0x00000800,
DOCHOSTUIFLAG_URL_ENCODING_DISABLE_UTF8 = 0x00001000,
DOCHOSTUIFLAG_URL_ENCODING_ENABLE_UTF8 = 0x00002000,
DOCHOSTUIFLAG_ENABLE_FORMS_AUTOCOMPLETE = 0x00004000,
DOCHOSTUIFLAG_ENABLE_INPLACE_NAVIGATION = 0x00010000,
DOCHOSTUIFLAG_IME_ENABLE_RECONVERSION = 0x00020000,
DOCHOSTUIFLAG_THEME = 0x00040000,
DOCHOSTUIFLAG_NOTHEME = 0x00080000,
DOCHOSTUIFLAG_NOPICS = 0x00100000
*/
pInfo->cbSize = sizeof(DOCHOSTUIINFO);
pInfo->dwFlags = DOCHOSTUIFLAG_NO3DBORDER | DOCHOSTUIFLAG_SCROLL_NO | DOCHOSTUIFLAG_DISABLE_SCRIPT_INACTIVE;
pInfo->dwDoubleClick = DOCHOSTUIDBLCLK_DEFAULT;
return S_OK;
}
Any help on this would be greatly appreciated!
Thanks!
Peter Gorgia
peter.gorgia@tradeweb.com
|
|
|
|
|
I am creating a window at run-time, using this command:
CChildFrame2* pMDIChildWnd = new CChildFrame2;
pMDIChildWnd->Create(NULL, _T("My "), WS_CHILD | WS_VISIBLE | WS_OVERLAPPEDWINDOW, rectDefault, NULL, NULL);
I've made a number of attempts to create a CCreateContext pContext, but have been unsuccessful. I think I might have to register some DocTemplate at initialization or something??
Please Help
A
|
|
|
|
|