|
the problem i what when i try to implement the body of the declaration into the class the compiler raise the mentioned error
may by i don't know how call the variable
class myClass{
static HHOOK myHook;
static LRESULT CALLBACK MouseProc(int nCode, WPARAM wParam, LPARAM lParam);
myClass();
};
static LRESULT CALLBACK myClass::MouseProc(int nCode, WPARAM wParam, LPARAM lParam){
return CallNextHookEx(myClass::hHook, nCode, wParam, lParam);
};
myClass::myClass(){
myClass::hHook = SetWindowsHookEx(WH_MOUSE, myClass::MouseProc, NULL, 0);
}
this is an example code of what i have...
|
|
|
|
|
To initialize static members from outside of the class declaration requires a slight change. See here for details.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
I found this page to display a bitmap and it works fine, but I need to replace each pixel value from a decompression routine done elsewhere in my app. In the broadstrokes, I'll open a bitmap image, send the bitmap data to be compressed, it'll be decompressed locally, then display the result. I can send the data fine and the decompression is no problem, but I need to display the decompressed result. I'm thinking I can open the image to fill the bitmap structure with the data it needs, then just drop in my decompressed data, then continue with the second half of the code to display the image. I can't seem to find any pages anywhere about this specifically because most projects only display images or maybe even change the palette values, but nothing as specific as what I'm trying to do. I tried to look at where the bitmap data is stored, then just allocate a chunk of memory the same size and just point to my new decompressed data rather than the data from the file but I couldn't locate that. Any help would be appreciated, thanks in advance, Nate.
|
|
|
|
|
the easiest way is to use something like StretchDIBIts.
you'll need to allocate enough memory for your pixels, with each row padded to a multiple of four bytes. then drop your pixels into the rows (in top-down order) - pixels arranged in Blue, Green, Red order. then fill out a BITMAPINFOHEADER structure and hand that to StretchDIBits. this is essentially making a DIB from your pixel data (though a true DIB would have the BMIH struct and pixels in a single buffer). and if you can do that, you're a BITMAPFILEHEADER away from a .BMP file.
well, actually, the easiest way is to run through your pixels and call SetPixel for each, but that's really slow.
Image Toolkits | Image Processing | Cleek
|
|
|
|
|
I'll only be dealing with 8-bit bitmaps. I already wrote the routines to open a bitmap file and read in all the data (2 headers and palette data) myself because I needed to access the actual bytes and that works fine. I figure I can just take those 2 filled out headers I made and hand it to StretchDIB like you mentioned.
|
|
|
|
|
I am getting a runtime error that an edit box variable on a dialog cannot be evaluated.
I am not seeing what the problem is and would appreciate it if someone can point it out to me.
There is a global variable declared as:
<br />
double currentBP;<br />
In the first initDialog of the program, currentBP is initialized.
Class CGetNewBP displays a dialog. There is an edit box for the user to enter a value. It is declared as:
<br />
double m_newBP;<br />
When the user clicks OK on this dialog, the value entered into the edit box is transferred to the global currentBP.
On another dialog, there is a button - Change BP. When this button is clicked, the
CGetNewBP dialog is displayed as modal. On return, the global currentBP which was just
updated is assigned to an edit box declared:
<br />
double m_currentBP;<br />
At this assignment, however, an exception is raised saying that m_currentBP cannot be
evaluated. If I comment out the call to create and display CGetNewBP, the code executes
without exception, and m_currentBP displays the initialized value of the global currentBP.
When the display CGetNewBP code is in, and execution is broken at the assignment statement,
the value in the global currentBP has been updated correctly.
<br />
void CModeCtrlDlg::OnBnClickedChangeBP ()<br />
{<br />
CGetNewBP getNewBP = new CGetNewBP;<br />
INT_PTR nResponse = getNewBP.DoModal();<br />
delete getNewBP;<br />
m_currentBP = currentBP; <- error message that m_currentBP cannot be evaluated<br />
UpdateData(false);<br />
}<br />
Without the first 3 lines, no error message and m_currentBP accepts the assignment
and displays on the screen.
I have tried further qualifying m_currentBP as CModeCtrlDlg::m_currentBP, with no success.
|
|
|
|
|
theFrenchHornet wrote:
In the first initDialog of the program...
You have more than one?
theFrenchHornet wrote:
There is an edit box for the user to enter a value. It is declared as:
double m_newBP;
The variable associated with the edit control should be CEdit .
theFrenchHornet wrote:
void CModeCtrlDlg::OnBnClickedChangeBP ()
{
CGetNewBP getNewBP = new CGetNewBP;
INT_PTR nResponse = getNewBP.DoModal();
delete getNewBP;
m_currentBP = currentBP; <- error message that m_currentBP cannot be evaluated
UpdateData(false);
}
Several things wrong here. First, don't use a heap-based variable unnecessarily. Second, UpdateData() is also unnecessary. Third, too many variable involved. Fourth, getNewBP is not a pointer so the new operator cannot be used. Try something like this instead:
class CGetNewBP : public CDialog
{
public:
CEdit m_edit;
double m_BP;
};
void CGetNewBP::OnOK()
{
CString str;
m_edit.GetWindowText(str);
m_BP = atof(str);
}
...
class CModeCtrlDlg : public CDialog
{
public:
CEdit m_editBP;
};
...
void CModeCtrlDlg::OnBnClickedChangeBP()
{
CGetNewBP dlg;
INT_PTR nResponse = dlg.DoModal();
if (IDOK == nResponse)
{
CString str;
str.Format("%f", dlg.m_BP);
m_editBP.SetWindowText(str);
}
} Make sense?
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
Yes - makes sense.
Thanks so much for the quick reply - big help - I learned - have implemented and works.
|
|
|
|
|
Hello,
I am trying to solve this problem many time ago, but yet no solution: how can i show a window (dialog from CDialog) with the topmost style (showing for the user) but without the focus?
Thanks,
Cris.
|
|
|
|
|
|
|
Hi guys,
I have a MPEG-2 transport stream with 2 pids (1 video, 1 audio) and I am looking for a way to convert it to a MPEG-2 program stream. I've been searching the internet for some time but most things I found were broken links. Does anyone know a good source for information?
Thanks for adivce,
Alex
Don't try it, just do it!
|
|
|
|
|
Hi,
I need to use a CString object in my dll,so i've included <afx.h> file.
the problem is that i get this error:
Compiling...
TCPlib.cpp
c:\program files\microsoft visual studio\vc98\mfc\include\afxv_w32.h(14) : fatal error C1189: #error : WINDOWS.H already included. MFC apps must not #include <windows.h>
Error executing cl.exe.
when i don't include <afx.h> i don't get this error,but i can't use CString.
what should i do?
Regards,
Eli
|
|
|
|
|
1. Ensure thatm you're not including windows.h anywhere in you're dll
2. ensure you have a precompiled header - e.g. stdafx.h
3. add #include <afxwin.h> to stdafx.h
4. make sure you're project settings are set to include MFC
Joel Holdsworth
Wanna give me a job this summer?
Check out my online CV and project history[^]
|
|
|
|
|
When you include a MFC header file you must not include windows.h.
MFC does include it!!
Furthermore you should better not use parts of MFC in an non-MFC application.
Don't try it, just do it!
|
|
|
|
|
Thanks for you prompt reply.
I need to make a regular dll with objects of MFC(i.e CString).
Which DLL workspace should i choose in the MSDEV?
regards,
Eli
|
|
|
|
|
If the program that will load the DLL might NOT be MFC, then choose MFC AppWizard (dll) as the project type. Then in Step 1 of the wizard, make sure you choose "Regular DLL with MFC statically linked". This will allow your DLL to use MFC but the parent application does not have to be an MFC program. Don't pass MFC objects between your DLL and your program, or you might experience memory issues and the created MFC objects are not necessarily from the same memory pools.
|
|
|
|
|
I have the same problem. But I can't solve it with these hints.
I've a COM-Client and Server. Both non-MFC. I can't find anywhere the windows.h.
|
|
|
|
|
If the problem is the 'windows.h' appearing in your files, is it possible both of you can try the include file dependency checker tool from CodeProject to see if that will help you locate it?
http://www.codeproject.com/useritems/includefinder.asp
|
|
|
|
|
Hello
I would like to add multiline text in the MFCGrid ... Is it possible to do such things without changing anything to the original code ?
Thanks for your help
Thierry
|
|
|
|
|
It already supports the display of multiline cells. You just have to clear the DT_SINGLELINE format.
pCell->SetFormat((pCell->GetFormat() & ~DT_SINGLELINE) | DT_WORDBREAK) Tooltips and in place editing need work though.
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
"Obviously ??? You're definitely a superstar!!!" mYkel - 21 Jun '04
Within you lies the power for good - Use it! Honoured as one of The Most Helpful Members of 2004
|
|
|
|
|
In my project I have, say, three string tables for
language packs - English, French and German.
After building all string tables(having same ID)
into the .exe file, how can I control which
string table the program should use during the runtime?
That is to say, if I want the outcome to be of English
interface, is there any way of coding to manipulate
the choice of the string table used?
Great thanks in advance for your reply
|
|
|
|
|
How can I change the tooltip of the restore button on the titlebar to display
"Full screen" instead of "Restore Down"?
|
|
|
|
|
Have a look at WM_NCHITTEST and WM_NCMOUSEMOVE. Maybe you can handle then in your own functions and create a tooltip yourself.
Don't try it, just do it!
|
|
|
|
|
hi,,
Anyone familiar with the AESalgorithm
There is an implementation of the AES algorithm in the below link. If u download it..
http://www.thecodeproject.com/cpp/aes.asp
in Table.h
(1.) Why have they used s boxes in ‘int’s? why not
const int CRijndael::SBox[256] rather than ---const char CRijndael::SBox[256] and replace the negative values with positive?
(2.) What does
const int CRijndael::sm_T1[256] …. const int CRijndael::sm_T8[256] tables correspond to?
(3.) and const int CRijndael::sm_U1[256]…const int CRijndael::sm_U4[256] tables correspond to
(4.) also const int CRijndael::sm_shifts[3][4][2] tables correspond to?
tnx
|
|
|
|