|
you are missing some thing some where
-----------------------------
"I Think It Will Help"
-----------------------------
Alok Gupta
visit me at http://www.thisisalok.tk
|
|
|
|
|
You might be using smart pointers and somewhere calling release on some interface pointer. This might be the cause. Check that out
-------------------------
Have a great day ahead!
Regards,
Sohail Kadiwala
(My COM Blog - http://lovecom.blogspot.com)
modified 21-Apr-21 21:01pm.
|
|
|
|
|
Sohail Bhai,
Happy Ramadan.
any knowledge about how to create Evallution dll,Runtime Dll or Developer DLL.
just need a little pointer towards that
-----------------------------
"I Think It Will Help"
-----------------------------
Alok Gupta
visit me at http://www.thisisalok.tk
|
|
|
|
|
Is there any Windows Audio Api's which allows for specifying any varying sample rate, other than fixed defaults. (8000, 11025, 22050, 44100)?
Thanks
|
|
|
|
|
Should I do this:
#include <iostream>
using namespace std;
or should I do this:
#include <iostream>
using std::cout;
using std::cin;
using std::endl;
.
.
.
I find that making the namespace std global in implementation
file easier to work with, but some people suggest avoid doing
that. Should I? Do you make namespace std global?
Thanks,
Alex
-----------------------------
C++ without virtual functions is not OO. Programming with classes but without dynamic binding is called "object based", but not "object oriented".
|
|
|
|
|
The second option is neater, and better style. In the real world, it's doubtful that you'll notice the difference. I always do the second, to be a nerd.
Christian
I have several lifelong friends that are New Yorkers but I have always gravitated toward the weirdo's. - Richard Stringer
|
|
|
|
|
I rarely use either. The whole point of namespaces is to be able to separate groups of things to avoid name clashes. The using directive basically gets rid of the namespaces and puts everything in the global namespace, making the use of the namespace pointless, especially the first form. If I do use the using directive, I use the second form. It's a lot cleaner and helps to prevent clutter of the global namespace.
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"
|
|
|
|
|
Okay, so if I use using namespace std;, does that mean the program will compile everything named under namespace std? Many people recommend not to make the namespace std global, but some say it doesn't matter. But I usually do the second way, typing explicitly using::string, using::cout......until I read the newly released book from Andrei Alexandrescu (highly repected person in the field), the book named C++ coding standard. (ISBN: 0-321-11358-6)
Here is a quote from the book:
But here's the common trap: Many people think that using declarations issued at namespace level (for example, using N::Widge) are safe. They are not. They are at least as dangerous, and in a subtler and more insidious way.
After reading this, I was thinking, am I doing the right way? So I thought I would ask people here how they are doing it.
<br />
#include <iostream><br />
using namespace std;<br />
<br />
int main()<br />
{<br />
return 0;<br />
}<br />
or should I do this:
<br />
#include <iostream><br />
using::cout;<br />
using::cin;<br />
using::endl;<br />
<br />
int main()<br />
{<br />
<br />
return 0;<br />
}<br />
-----------------------------
C++ without virtual functions is not OO. Programming with classes but without dynamic binding is called "object based", but not "object oriented".
|
|
|
|
|
Alex Ngai wrote:
But here's the common trap: Many people think that using declarations issued at namespace level (for example, using N::Widge) are safe. They are not. They are at least as dangerous, and in a subtler and more insidious way.
Which is exactly why I rarely use them either. Promoting any namespace member to the global namespace (which is what the using directive actually does) has the rather dangerous ability to shadow a member already in the global namespace with the same name, much like an overloaded function, but a lot more subtle. These errors can be very difficult to debug.
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"
|
|
|
|
|
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
|
|
|
|
|