|
For custom messages that are mapped using ON_MESSAGE the handler must have a signature that returns an LRESULT and takes 2 parameter of WPARAM and LPARAM .
So your OnCreate function must look like this -
LRESULT CThreadView::OnCreate(WPARAM wParam, LPARAM lParam);
«_Superman_»
I love work. It gives me something to do between weekends.
|
|
|
|
|
have a look at this
http://msdn.microsoft.com/en-us/library/k35k2bfs(VS.80).aspx[^]
look carefully at "The type of the function must be afx_msg LRESULT (CWnd::*)(WPARAM, LPARAM).", their example
LRESULT CMyWnd::OnMyMessage( WPARAM wParam, LPARAM lParam )
{
return 0L;
}
vs yours ..
int CThreadView::OnCreate(LPCREATESTRUCT lpCreateStruct)
interestingly, your "OnThreadended" ie
LONG CThreadView::OnThreadended(WPARAM wParam, LPARAM lParam)
{
CString strThreadEnd = _T("Thread ended.");
AfxMessageBox(strThreadEnd, 0,0);
return 0;
}
appears ok
|
|
|
|
|
Thanks for your help.
Can you tell me please how can call or access a global variable or a function defined in th Doc.cpp or anyaother class from inside UINT ThreadProc (LPVOID param)?
UINT ThreadProc(LPVOID param)
{
CTestDoc* pDoc = GetDocument(); // error: GetDocument() is not defined???
ASSERT_VALID(pDoc);
::WaitForSingleObject(m_Thread_Sel_Start.m_hObject , INFINITE);
::MessageBox((HWND)param, strThread_Start, strThread_Caption, MB_OK);
CSQLCommand::FindSQLCmd(pDoc,m_strSelect);// error :m_strSelect is defined in the CTestView.h but he can not find it , pDoc is already unkown
bool bKeepRunning = true;
while(bKeepRunning)
{
int nResult = ::WaitForSingleObject (m_Thread_Sel_End.m_hObject ,0);
if(nResult == WAIT_OBJECT_0)
bKeepRunning = false;
}
::PostMessage((HWND)param, WM_THREADENDED, 0, 0);
return 0;
}
Can i define the UINT ThreadProc(LPVOID param) in the CTestDoc.cpp?
And why when i declare UINT ThreadProc(LPVOID param) in the CTestView.h i get this error:
error C3867: "CTestView::ThreadProc": use "&CTestView::ThreadProc".
and when i use &CTestView::ThreadProc i get a csting problem that can not be solved through an explict cast.
|
|
|
|
|
hii all
its a C Programme.
i need to check characters in a string(character pointer)so that i can diffrenciate my strings for alphabatic character and numeric character.
there are scenerios where i have to invalidate string containing even a single alphabatic character.
and in other scenarios i have to invalidate those strings which contain even a single numeric character.
i am new in this C field so please provide me code to implement it.
|
|
|
|
|
Looks like an assignment.
May I politely ask you to read about if-else statement[and other conditional statements] and also the loops
You need to google first, if you have "It's urgent please" mentioned in your question.
_AnShUmAn_
|
|
|
|
|
buddy i have red all these things..now can someone plz provide me solution
|
|
|
|
|
Vikas, if you have read all those things you should be able to solve the problem. Nobody here writes programs for you.
|
|
|
|
|
vikas choudhry wrote:
i am new in this C field so please provide me code to implement it.
May I politely ask you to read forum posting guidelines [^]?
About your problem, what is your doubt about? Aren't you able to traverse the string? Aren't you able to differentiate among alphabetic character and numeric character?
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]
|
|
|
|
|
vikas choudhry wrote: i am new in this C field
are you a student?
|
|
|
|
|
Run a loop for the length of the string, check each character to find if it is an alphabet or a number. Invalidate, as per requirements. What have you done so far and where are you stuck?
It is a crappy thing, but it's life -^ Carlo Pallini
|
|
|
|
|
If you are going for pure c program then
take the character array and check each character with the ASCII range.
say
ur char ch[350]
if( 48 >= ch[i] &&
57 <= ch[i] ) then it is numerical
if(( 65 >= ch[i] || 97 >= ch[i] ) &&
( 90 <= ch[i] || 122 <= ch[i] )
then it will be alphabets
Величие не Бога может быть недооценена.
modified on Friday, July 31, 2009 6:46 AM
|
|
|
|
|
|
There's also this...
#include <string>
using std::string;
string str1 = "abc123";
if(str1.find_first_of("0123456789") != string::npos)
{
}<pre>
|
|
|
|
|
Hi,
I had a simple client/server application that excahnges text data through array of bytes (BYTE byBuffer[256]). Now the server wants to transmit the image data (CBitmap) to the client. How the CBitmap object can be converted into array of bytes and then on receiving end (client) it can be converted back into CBitmap.
THANKS.
|
|
|
|
|
To get the CBitmap to byte use
GetBitmap( BITMAP* pBitMap ); refer http://msdn.microsoft.com/en-us/library/279a3c0c(VS.80).aspx[^]
of CBitmap where LPVOID bmBits member of BITMAP will having the byte array.
To set the BYTE array to CBitmap, you can use DWORD SetBitmapBits( DWORD dwCount, const void* lpBits ); you can set your byte array to lpBits.
Величие не Бога может быть недооценена.
|
|
|
|
|
Thanks.
I am facing problems with GetBitmap , however GetBitmapBits is giving me byte of array properly.( I guess). but I am unable to get the size of these bits for SetBitmapBits( DWORD dwCount, const void* lpBits ).
|
|
|
|
|
you getting any error in GetBitmapBits?
r u not getting the size?
Величие не Бога может быть недооценена.
|
|
|
|
|
I tried with the way discussed in the article as well. Using GetBitmapBits and SetBitmapBits[^]
but it does not work.
There is no error but the output is not correct.
see the code below
CDeskTop desktop;
BITMAP bmpX,bmpY;
CBitmap mybmp,bmpClone;
DWORD dwValue,dwValue2;
mybmp.Attach(desktop.GetDeskTopImage());
mybmp.GetBitmap(&bmpX );
bmpClone.LoadBitmap(IDB_BITMAP1); // IDB_BITMAP1 bears the same co-ordinate as the source
int x=bmpX.bmHeight*bmpX.bmWidth;
BYTE* bmpBuffer=NULL;
bmpBuffer=(BYTE*)GlobalAlloc(GMEM_ZEROINIT,bmpX.bmWidth*bmpX.bmHeight);
dwValue=mybmp.GetBitmapBits(bmpX.bmWidth*bmpX.bmHeight,bmpBuffer);
dwValue2 = bmpClone.SetBitmapBits(bmpX.bmWidth*bmpX.bmHeight,bmpBuffer);
bmpClone.GetBitmap(&bmpY);
CDC memDC;
CClientDC dc(this);
memDC.CreateCompatibleDC(&dc);
memDC.SelectObject(&bmpClone );
dc.BitBlt(0, 0, bmpY.bmWidth, bmpY.bmHeight, &memDC, 0, 0,SRCCOPY);
DeleteDC(dc.m_hDC);
GlobalFree((HGLOBAL)bmpBuffer);
|
|
|
|
|
I have written a program in matlab to find correlation between two images...
I want that program in C..
I like to implement it in hardware, so matlab codings cant be used as it is..
So i want an equialent C codings..
Is there any convereters to obtain equivalent C codes....?
Please help me...
|
|
|
|
|
Hi,
I'd like to know.
Is it possible to convert power point (.ppt ) to image file(jpg or bmp) with VC6?
Actually, I want slide show in my VC6 application. so I need to convert .ppt file to several image files...
Any comment will help me..
Have a day.
|
|
|
|
|
This[^] should help.
More links that can help you: here[^]
You need to google first, if you have "It's urgent please" mentioned in your question.
_AnShUmAn_
|
|
|
|
|
Hi.. I did one project in visual c++..now i need to convert into java ..I have a doubt .does both programming lang has any similarities in library files..
|
|
|
|
|
Figure out what is done in the C++ on the functionality front. Then you can implement the same in JAVA. I don't see much other than the oops concept being the same in either of the languages.
On another note, may I politely ask why do you need to convert the C++ code to Java code.
You need to google first, if you have "It's urgent please" mentioned in your question.
_AnShUmAn_
modified on Friday, July 31, 2009 5:02 AM
|
|
|
|
|
You cannot do a C++ to Java 'conversion' as such. Think of pointers, for instance. Period.
You wrote the program, right? So, you know what it does. Now, just rewrite it in Java.
It is a crappy thing, but it's life -^ Carlo Pallini
|
|
|
|
|
C++ syntax can be converted (even most pointers), but the real challenge for you will be to find the equivalent underlying library functionality in the Java library.
David Anton
http://www.tangiblesoftwaresolutions.com
Convert VB to C#, C++, or Java
Convert C# to VB, C++, or Java
Convert C++ to C#, VB, or Java
Convert Java to C#, C++, or VB
|
|
|
|