|
|
ok thank you. I shall try again.
|
|
|
|
|
> and QMAKESPEC=win32-msvc2008.
But in the original message you tried to use MingW??
Gisle V.
# rm -vf /bin/laden
/bin/rm: success
|
|
|
|
|
I am still having problems to make a static build of QT application
My exe is not working in any other systems which may or may not have QT. Can anybody help me with exact steps? As a beginner I don't have much idea about this
|
|
|
|
|
You should joint the Qt-interest mailing list interest@qt-project.org
and ask there.
Gisle V.
# rm -vf /bin/laden
/bin/rm: success
|
|
|
|
|
Suppose we have a class:
class container
{
public:
container(sometype *itp)
{
item = itp;
}
~container();
private:
sometype *item;
};
It's possible to use the class object in these ways:
void function()
{
sometype item;
sometype *pitem;
container ct1(&item);
pitem = new sometype;
container ct2(pitem);
}
I'd like to destroy sometype pointer in class's destructor provided it was created on the heap by new operator but not that on the stack. How to make it?
modified 5-Jan-14 0:22am.
|
|
|
|
|
There is no way to tell just by the variable itself, but you could provide a flag to the constructor to indicate the difference:
class container
{
public:
container(sometype *itp, bool HeapFlag)
{
item = itp;
Flag = HeapFlag;
}
~container();
{
if (Flag)
delete item;
}
private:
sometype *item;
bool Flag;
};
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
|
I think I've just found pretty good solution which, however, may not work well in multithreaded environment. Let's add a static variable bool heapcreated , a flag createdflag and overload operator new . That would look like this:
class sometype
{
protected:
static bool heapcreated;
bool createdflag;
public:
sometype()
{
createdflag = heapcreated;
heapcreated = false;
}
bool IsHeapCreated()
{
return createdflag;
}
void *operator new(size_t n)
{
sometype *stp=::new sometype;
heapcreated = true;
return stp;
}
class container
{
public:
container(sometype *itp)
{
item = itp;
}
~container();
{
if (item->IsHeapCreated())
delete item;
}
private:
sometype *item;
};
The new destructor of container would behave different depending on mode of sometype creation. I've searched this solution to be used when you build a library and you do not want a caller to have to do an overhead work adding a flag parameter. If you had to make many calls to container constructor with pointers to sometype it would be slightly difficult to save somewhere the pointers and then delete them. Also, you should be able to pass a pointer to stack variable which must not be deleted explicitly.
It's a bit tricky but my simple test works.
|
|
|
|
|
Good on you! That's a clever solution.
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
|
I was able to find the answer to this question at the end of this post:
http://social.msdn.microsoft.com/Forums/vstudio/en-US/3c4c722d-eecd-49ce-98f9-5948b656bd93/wsextoolwindow-doesnt-give-look-i-want-in-windows-8?forum=vcgeneral[^]
=========
I am creating a window with the WS_EX_TOOLWINDOW style on Windows 8, and the window ends up with the full-height title bar instead of the expected half-height title bar of a tool window.
Does Windows 8 not support this half-height title bar for tool windows, or am I doing something wrong?
Here is the window creation:
hWnd = CreateWindowEx(WS_EX_TOOLWINDOW | WS_EX_TOPMOST, _TEXT("Class"), _TEXT("Caption"), WS_SYSMENU | WS_VISIBLE | WS_SIZEBOX | WS_CLIPCHILDREN | WS_CLIPSIBLINGS, CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, NULL, NULL, hInstance, NULL);
EDIT:
I just tested this in a Win 7 virtual machine, and I get the expected half-height title bar, so apparently this has something to do with Windows 8. Does anyone have any idea how to get the half-height title bar in Windows 8?
The difficult we do right away...
...the impossible takes slightly longer.
modified 3-Jan-14 9:37am.
|
|
|
|
|
I am working on a Windows program in C++ that downloads a variable number of files into a directory. Before I do the download, I want to delete all the files in the directory before downloading them. I do not want to write a separate script to do this. I want the C++ program to do it. What is the easiest way to do this?
Bob
|
|
|
|
|
|
BobInNJ wrote: What is the easiest way to do this? I suppose SHFileOperation() would be.
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Show me a community that obeys the Ten Commandments and I'll show you a less crowded prison system." - Anonymous
|
|
|
|
|
Thanks for the responses. Based upon the responses I received I was able to write the code I wanted.
Bob
|
|
|
|
|
How can my CWnd object retrieve the mouse coordinates while processing the WM_MOVING message?
Is there a function like "GetMouse() "?
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
|
You probably need to capture the mouse and then use one of the tracking functions[^].
Veni, vidi, abiit domum
|
|
|
|
|
Ah, so that's how it's done. Thanks.
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
|
Does GetCursorPos() help?
|
|
|
|
|
Yes, that's very helpful. I'll remember that for next time.
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
|
SandipG wrote: Does GetCursorPos() help?
I ended up using the function you suggested. Thanks again.
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
|
Hello. I can not seem to understand how to show 640 x 480 RGB data onto a dialog as a single picture. Following code uses SetPixel() to show it but looks like it makes and show two pictures of 320 x 240.
void CShowPicDlg::OnShowClick()
{
CDC* pDC = this->GetDC();
DWORD dwStartIndexRGB = 1, dwMiddleIndexRGB = 2, dwEndIndexRGB = 3;
for (int y = 0; y < 480; y++) {
for (int x = 0; x < 640; x++) {
POINT wndPoint;
wndPoint.x = x;
wndPoint.y = y;
BYTE r = m_pFrameData[dwStartIndexRGB];
BYTE g = m_pFrameData[dwMiddleIndexRGB];
BYTE b = m_pFrameData[dwEndIndexRGB];
pDC->SetPixel(wndPoint, RGB(r, g, b));
dwStartIndexRGB += 4;
dwMiddleIndexRGB = dwStartIndexRGB + 1;
dwEndIndexRGB = dwStartIndexRGB + 2;
if(dwStartIndexRGB >= m_nSize)
break;
}
}
}
So
1 - why is it showing two similar pictures of smaller frame size while the data itself is a single picture with frame size 640 x 480 ?
2 - how do I set alpha value for getting original colors?
Thanks for any pointer.
modified 1-Jan-14 23:34pm.
|
|
|
|
|
What is the value of m_nSize ?
if(dwStartIndexRGB >= m_nSize)
break;
Veni, vidi, abiit domum
|
|
|
|
|
It is size of the data. I am storing this data and its size using constructor. The size of the data is 614400 . As said earlier, frame size is 640 x 480 and video format is RGB32.
|
|
|
|
|
640 * 480 * 4 bytes/pixel = 1,228,800 bytes. A size of 614,400 indicates that you may have smaller images or less colors.
You should also consider to use one of the bit blitter functions to show the images. They are much faster than drawing them pixel by pixel.
|
|
|
|
|
I am using IMFSourceReader interface to get frames from my HD cam. After configuring this interface when I call IMFSourceReader::ReadSample() function, I am given IMFSample pointer. Now this IMFSample contains the video data and its size. And the size is 614400.
I must point out that using the same configurations, I am writing the same data in a .wmv file using IMFSinkWriter . So how is it possible that .wmv file has the frame size 640 x 480 and then the same data, when drawing pixel by pixel, gets smaller?
I am stuck in it for the last two weeks. Still not idea how to display a frame on dialog, this way.
|
|
|
|