|
You can't do this. "Windowless" means it's not a windows control so it doesn't have a window handle so you can't use APIs to interact with it. It's been created by code within the application to look and function as a button but it's not a Windows button.
|
|
|
|
|
Hey, Thanks !
Yeah, I knew all that, but I was hoping someone will come up with a technique I didn't think of.
Currently I am using the x,y of the window OR using spy++ to see if there is another message being sent because of my click (some kind of WM_COMMAND or WM_USER+k).
Anyway, thanks again.
|
|
|
|
|
I try to embed the window of my program in the desktop.The window is under the desktop icons without covering them!
I have tried the following method.
As far as I know,the desktop consists of four sub-layers.Using spy++,I find the first three layers--1.SysListView32 2.SHELLDLL_DefView 3.Program Manager.
I tried to put my window on top of the second layer.
BOOL CTestDialogDlg::OnInitDialog()
{
CDialog::OnInitDialog();
ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX);
ASSERT(IDM_ABOUTBOX < 0xF000);
CMenu* pSysMenu = GetSystemMenu(FALSE);
if (pSysMenu != NULL)
{
CString strAboutMenu;
strAboutMenu.LoadString(IDS_ABOUTBOX);
if (!strAboutMenu.IsEmpty())
{
pSysMenu->AppendMenu(MF_SEPARATOR);
pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu);
}
}
SetIcon(m_hIcon, TRUE);
SetIcon(m_hIcon, FALSE);
HWND tmpHandle = ::FindWindow("Progman",NULL);
tmpHandle = ::GetWindow(tmpHandle,GW_CHILD);
CWnd* pWndDesktop = CWnd::FromHandle(tmpHandle);
this->SetParent(pWndDesktop);
tmpHandle = ::GetWindow(tmpHandle,GW_CHILD);
::SetWindowPos(tmpHandle, HWND_TOPMOST, 0, 0, 0, 0, SWP_SHOWWINDOW|SWP_NOSIZE);
return TRUE;
}
However,this method dosen't work.Does anybody have some guidance on how to do this?
|
|
|
|
|
hi all
how can i set print area in a SDI project?
indeed i want to see specific view of my document in print preview(on any page setup).
regards
|
|
|
|
|
Hi i want to serialize a class in c++. I got main class CElementy and other subclasses like CZamow it gives error like this:
Error 2 fatal error LNK1120: 1 unresolved externals
Error 1 error LNK2019: unresolved external symbol "protected: __thiscall CZamow::CZamow(void)" (??0CZamow@@IAE@XZ) referenced in function "public: static class CObject * __stdcall CZamow::CreateObject(void)" (?CreateObject@CZamow@@SGPAVCObject@@XZ) Elementy.obj
I think it is some kind of problem with inheritance the code goes like this:
Elementy.h
class CElementy : public CObject
{
DECLARE_SERIAL(CElementy)
protected:
COLORREF m_Color;
CRect pz;
int m_Pen;
public:
virtual ~CElementy();
virtual void Draw(CDC *pDC, CElementy* pElement=0) {}
virtual void Move(CSize& aSize){}
virtual void Serialize(CArchive& ar);
CRect Prst();
protected:
CElementy(void);
};
class CZamow :
public CElementy
{
DECLARE_SERIAL(CZamow)
public:
~CZamow(void);
virtual void Draw(CDC* pDC, CElementy* pElement);
virtual void Serialize(CArchive& ar);
CZamow(CPoint Pc, CPoint Kn, COLORREF aColor);
protected:
CPoint m_PunktP;
CPoint m_PunktD;
CZamow(void);
};
Elementy.cpp
#include "stdafx.h"
#include "VSM1.h"
#include "Stale.h"
#include "Elementy.h"
#include "math.h"
IMPLEMENT_SERIAL(CElementy, CObject, VERSION_NUMBER)
IMPLEMENT_SERIAL(CZamow, CElementy, VERSION_NUMBER)
CElementy::CElementy()
{
}
CElementy::~CElementy()
{
}
...
void CElementy::Serialize(CArchive& ar)
{
CObject::Serialize(ar);
if (ar.IsStoring())
{
ar << m_Color
<< pz
<< m_Pen;
}
else
{
ar >> m_Color
>> pz
>> m_Pen;
}
}
..
CZamow::CZamow(CPoint Pc, CPoint Kn, COLORREF aColor)
{
m_PunktD = Kn;
Pc = (m_PunktD.x + 100, m_PunktD.y + 80);
m_Color = aColor;
m_Pen = 1;
pz = CRect(Kn, Kn);
pz.NormalizeRect();
}
CZamow::~CZamow(void)
{
}
..
void CZamow::Serialize(CArchive&ar)
{
CElementy::Serialize(ar);
if (ar.IsStoring())
{
ar << m_PunktP << m_PunktD;
}
else
{
ar >> m_PunktP >> m_PunktD;
}
}
|
|
|
|
|
You didn't define (i.e. implement in source file) CZamow class default constructor.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
thanks it works now strange everything worked without it :P
|
|
|
|
|
Hi
The question looks simple...
I m using splitter window with various forms in right hand view(CFormView)
In One of the Form i have created a funtion.
I need to call this function in another FormView.
I m tryin the following way
"
CForm1 Frm1;
Frm1.Functionname();"
But i get error as Cannot access protected Class
Can anyone help me...
|
|
|
|
|
Hi
actually i m tryin to insert a treecontrol values.
Thats the error now showin
|
|
|
|
|
I'm a student of a university in Viet Nam. I'm working my project which is my home word. My teacher request me write a program as Total commander. But I don't know how to write. If you know or you have it, can you share for me ?
Help me. please. thanks!
|
|
|
|
|
No, if indeed you are a student, do your own homework. No one here is going to send you source code for anything.
The wonderful thing about the Darwin Awards is that everyone wins, especially the members of the audience.
|
|
|
|
|
ok. so I do it by myself, thank you reply.
|
|
|
|
|
You *could* try and get your money back as you clearly haven't learned anything.
Why is common sense not common?
Never argue with an idiot. They will drag you down to their level where they are an expert.
Sometimes it takes a lot of work to be lazy
Individuality is fine, as long as we do it together - F. Burns
Help humanity, join the CodeProject grid computing team here
|
|
|
|
|
thanhkhanhcntt wrote: But I don't know how to write
That's why this[^] wonderful site was developed, just enter the kind of code you want and you email address and they do the rest!....free no less!
|
|
|
|
|
|
What is not working ? Compilation errors/warnings ? wrong values ? crash ?
Is it a typo that your first include line is commented out ?
Watched code never compiles.
|
|
|
|
|
no the code is compiling in visual studio but it got stuck i am working on this from past 2 days and ots not working that the producer is producing but consumer is not consuming and according to logic it must be random but when producer produces 10 times code get halt and no consumer work i am very new to this language if you can help then it will be appreciated....
please help
|
|
|
|
|
It may help if you post your code using "code block" style with proper indention -- something like this
int main()
{
int buffer[NUM];
int start;
int end;
int PTemp;
int CTemp;
int full,empty;
int dataNum;
int np,nc,finished;
double time_start;
PTemp=CTemp=start=end=full=dataNum=np=nc=finished=0;
empty=1;
....
}
People will be more willing to read your code like this than what you posted.
|
|
|
|
|
hello i am new to this so sorry for that but if you can correct it then it will be a great help i have even made the win32 threads code of this producer consumer problem in c++ which is working but open mp one is not working so help me in this if you want then i can even post the win32 threads code
|
|
|
|
|
aruneshjoshi wrote: #pragma omp section nowait //producer's code
Should this be:
#pragma omp sections nowait // producer's code
"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
"Man who follows car will be exhausted." - Confucius
|
|
|
|
|
thanks for your help but still code is not working
|
|
|
|
|
You might get the help you need if you join the OpenMP forums and post your question there. All the best OpenMP experts are there to help you, including the folks who created the OpenMP API.
http://openmp.org/forum/[^]
|
|
|
|
|
I am wondering if the type passed to delete[] needs to be the same as the type allocated by new? I am attempting to do the following:
void** memPoolPtrs = new void* [4 * (1 + 12)];
double* memPoolData = new double[4 * 12 * 30];
double*** myData = reinterpret_cast<double***>(memPoolPtrs);
memPoolPtrs += 4;
for (size_t idx0 = 0; idx0 < 4; ++idx0) {
myData[idx0] = reinterpret_cast<double**>(memPoolPtrs);
memPoolPtrs += 12;
for (size_t idx1 = 0; idx1 < 12; ++idx1) {
myData[idx0][idx1] = memPoolData;
memPoolData += 30;
}
}
delete[] **myData;
delete[] myData; Is there any risk in the above approach (other than allocating things of improper size)? I can't think of a reason why such a thing wouldn't work, but I am curious if the two delete statements will work as I anticipate. Thanks,
Sounds like somebody's got a case of the Mondays
-Jeff
modified on Friday, April 16, 2010 12:41 PM
|
|
|
|
|
Since the delete operator takes a void* type, it doesn't matter what type is passed for deletion as long as it is the starting address of the allocation.
|
|
|
|
|
For yor case it works.
As a general rule it won't.
delete[] against an object, whose type has a destructor will call the 'vector deleting destructor', which will call the destructor for each element.
The problem is the number of elements.
When new[] is called on a type with a destructor:
1. malloc a block large enough to hold the reqested # of elements, the actual block size will be rounded up to some grain size.
2. store the actual block size (bytes) with the block for free().
3. store the requested # of elements with the block so delete[] can iterate over them and call ~().
When you call delete on a different (sized) type the # of elements stored with the block will be wrong and you will either call ~() on too few or too many elements.
If too few then you could have a memory leak if the destructor frees resources.
If too many then you corrupt the heap.
...cmk
The idea that I can be presented with a problem, set out to logically solve it with the tools at hand, and wind up with a program that could not be legally used because someone else followed the same logical steps some years ago and filed for a patent on it is horrifying.
- John Carmack
|
|
|
|