i have created a win32 window it work fine but im tryin to get command argument using lpcmdline. it works fine but when i try to compare it to string it to does work here is the comparing code
TCHAR checking[]=_T("hello");
if(args==checking) // args equals lpcmdline like this LPTSTR args=lpcmdline
{
TCHAR greeting[]=_T("heys");
}
e...
Sometimes with a complex header structure it happens some header is included, but it is hard to tell where from.
Is there some tool (depedency viewer?) or a method how to find the "inclusion stack" (which source / which header / which header / ...) is including one particular header file?
If the header file is included multiple times, ...
How to get logged-in user's full name (the one he/she entered as his/her real name) using windows API or something else? For example how to get "John Smith", not "john" (as it were his username).
GetUserName(...) doesn't do the job because it returns the username, not the full name.
...
I want to write a program for printing stuff on a paper, roughly what commands or classes do i need to use in c++ or php to get me started ?
...
I'm having a bit of trouble with a C++ program I'm working on. I've created an abstract class with a single pure virtual method. Since the class has no variables or implemented methods, I've stored the class in a header file without an .cpp implementation file (there isn't any need for one).
The method is:
virtual void handleEvent() = ...
I think many of you have this kind of code somewhere:
int foo;
switch (bar) {
case SOMETHING: foo = 5; break;
case STHNELSE: foo = 10; break;
...
}
But this code has some drawbacks:
You can easily forget a "break"
The foo variable is not const while it should be
It's just not beautiful
So I started wondering if there was a...
The foolowing reduced code sample does not do anything usefull but two subsequent assignments to a data member pointer. The first assignement works, the second one gives a compiler error. Presumably because its to a nested member.
Question would be: Is it really just not possible to let a member pointer point to a nested member or am I ...
Hello again, StackOverflow!
Today's issue is a bit odd, but please bear with me. Any advice / suggestions extremely appreciated!
I've inherited an old codebase on a project with some components that date back to 2002. There is no documentation at all for this project, and the original machine which had the build set up on no longer exi...
Hi,
I have a header file MyNameSpace.h where i use namespace as under:
namespace NameSpace1
{
string first = "First";
...
}
namespace NameSpace2
{
string top = "Top";
}
But when i use the namespace object in my other classes including the header file. I got Duplicate symbol error as NameSpace1::first. What exactly it means and how ...
How much memory or other resources is used for an individual VirtualAlloc (xxxx, yyy, MEM_RESERVE, zzz)?
Is there any difference in resource consumption (e.g. kernel paged/nonpaged pool) when I allocated one large block, like this:
VirtualAlloc( xxxx, 1024*1024, MEM_RESERVE, PAGE_READWRITE )
or multiple smaller blocks, like this:
Vi...
LARGE_INTEGER lpPerformanceCount, lpFrequency;
QueryPerformanceCounter(&lpPerformanceCount);
QueryPerformanceFrequency(&lpFrequency);
(Count.QuadPart is a long long showing a CPU count)
(Freq.QuadPart is a long long showing frequency of Count for a second)
Attempting to print microseconds in real time.
stable output:
printf("%llu\...
I wanted to get both icon and text, so I didn't set BM_ICON on my button. In
WM_INITDIALOG (yes, the button is in a dialog) I say:
SendDlgItemMessage(hwndDlg, IDC_CREATE, BM_SETIMAGE, IMAGE_ICON, reinterpret_cast<LPARAM>(create_image));
It doesn't work. The button shows text only. Now, if I do set the BS_ICON
style, it works, but ther...
Profiler says that 50% of total time spends inside this function. How would you optimize it?
It converts BMP color scheme to YUV. Thanks!
Update: platform is ARMV6 (writing for IPhone)
#define Y_FROM_RGB(_r_,_g_,_b_) ( ( 66 * _b_ + 129 * _g_ + 25 * _r_ + 128) >> 8) + 16
#define V_FROM_RGB(_r_,_g_,_b_) ( ( 112 * _b_ - 94 * _g_ - 18 ...
Consider the following example code which I have recently seen in our code base:
void ClassA::ExportAnimation(auto_ptr<CAnimation> animation)
{
... does something
}
// calling method:
void classB::someMethod()
{
auto_ptr<CAnimation> animation (new CAnimation(1,2));
ClassA classAInstance;
classAInstance.ExportAnimation(animation)
...
We all know about -> vs . speed diff to access members in c/c++, but I am hard to find any clues of the actual cost of the simple dot operator.
I imagine its something like address-of-struct + offset, also assume the offset being the sum of all sizeof-s of all preceding members. Is this (roughly) correct?
Then compared to -> who much f...
Hi,
I've got an issue with Qt4 focus handling. Since QDateEdit does not support NULL values, I've tried to emulate such a widget by using a QLineEdit with an inputMask. But event with the inputMask the user is still able to enter an invalid date (e.g. 44/44/4444). In that case I want to display an error messagebox when the user leaves t...
Hi,
I am doing programming in C++, under LINUX.
I have two independent processes. I should provide communication using named pipe.
Reader:
-creates FIFO using mkfifo - status = mkfifo(myFIFO, 0666)
-opens the pipe using open - fifo = open (myFIFO,O_RDONLY)
-reads from the pipe - num = read(fifo, temp, sizeof(temp))
Writer:
-opens pi...
A MDIParent Wnd has many MDIchild Wnds, and also few child dialogs.
Dialogs are created this way ---
CAutoDlg *pDlg = new CAutoDlg;
pDlg->Create(IDD_AUTOCARD,this);
I want to cascade only a specific type of dialogs, say dialogs of CAutoDlg type only.
If i give MDICascade() it cascades all the child windows and dialogs under the MD...
Possible Duplicate:
In C++ why cant I write a for() loop like this: for( int i = 1, double i2 = 0;
A C developer would write this:
int myIndex;
for (myIndex=0;myIndex<10;++myIndex) ...
A C++ developer would write this to prevent the loop variable from leaking outside the loop:
for (int myIndex=0;myIndex<10;++myIndex) ...
...
I need some help to find a memory leak in my C++ code. I try to put these lines in my constructor but it causes a memory leak because of lines 2 and 3 in the constructor:
Myclass::Myclass()
{
ACE_Time_Value tm = ACE_OS::gettimeofday();
m_obj.firstStr() = tm.sec();
m_obj.secondStr() = tm.usec();
}
Here, firstStr() and secondStr(...