|
Use LoadLibrary for initializing rich edit control.
You main window procedure would look like this,
LRESULT CALLBACK WndProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam)
{
switch(Message)
{
case WM_CREATE:
hLib = LoadLibrary("RICHED32.DLL");
break;
case WM_CLOSE:
DestroyWindow(hwnd);
FreeLibrary(hLib);
break;
..
}
|
|
|
|
|
Hi Prasad,
what shd be the hlib variable type ??? and where we have to declare that variable??
error C2065: 'hLib' : undeclared identifier
|
|
|
|
|
Its HMODULE . You can declare it as
HMODULE hLib;
I've just given example.
Only thing important, you need to load dll before invoking dialog.
|
|
|
|
|
Hi Prasad,
I did changes as u have mentioned.
But still no changes , still the dialog is not getting displayed which contains rich edit box.If i remove the Rich edit control Dialog is getting displayed.
I have 3 dialogs one main another sub dialogs , in the sub dialog I have the rich edit control.
The main MainDlgProc
<br />
BOOL CALLBACK MainDlgProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam)<br />
{<br />
HMODULE hLib;<br />
switch(Message)<br />
{<br />
<br />
case WM_CREATE:<br />
hLib = LoadLibrary("RICHED32.DLL");<br />
break;
and the sub dialog DlgProc
<br />
BOOL CALLBACK SearchDlgProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam)<br />
{<br />
HMODULE hLib;<br />
switch(Message)<br />
{<br />
case WM_CREATE:<br />
hLib = LoadLibrary("RICHED32.DLL");<br />
break; <br />
I am using windows 2000 OS with VC6.
|
|
|
|
|
Dear ! dear !
I mentioned in earlier reply, you need to load library before invoking dilaog. I'd assumed , you main application window is not dialog window in question, and window procedure I mentioned is of main window. So use given procedure with main window.
You should get idea from this snippet,
hLib = LoadLibrary("RICHED32.DLL");
ret = DialogBox(GetModuleHandle(NULL),
MAKEINTRESOURCE(IDD_MYDLG), hwnd, MyDlgProc);
if(ret == -1)
{
MessageBox(hwnd, "Dialog failed!", "Error",
MB_OK | MB_ICONINFORMATION);
}
FreeLibrary(hLib );
|
|
|
|
|
At last ………Its working ……
Thanks a lot Prasad …. I actually adding the dll file load in DlgProc after dialog load that my mistake which I did … now I have added in the WinMain ..now the dialog is getting displayed with the rich control.
Thanks a lot Prasad once again …
|
|
|
|
|
If you want to use of functions on a dll you need first to load it dll and then use of functions
|
|
|
|
|
How to get value in 16 bit interger from buffer..thanks in advance.
uint16_t value;
buffer->buf[buffer->buf_end++] = 0x03; //1 byte
buffer->buf[buffer->buf_end++] = 0xe8; //1 byte
Now I want to get like
value= 0x3e8
thanks.
|
|
|
|
|
Play it again, Sam?
value = (buffer->buf[buffer->buf_end-2]) << 8 | (buffer->buf[buffer->buf_end-1]);
Note that if yoou load the buffer in reverse order the you can do the quick and dirty:
value = *((unsigned short *)& buffer[buffer->buf_end-2] );
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.
|
|
|
|
|
thanks ---i manage to do that by ur help
value=(buffer->buf[buffer->buf_ptr+1] << 8 | (buffer->buf[buffer->buf_ptr+2]));
|
|
|
|
|
uint16_t value;<br />
<br />
value = 0x03;
value * 256; <br />
value += 0xe8;
Multiplying by 256 shifts the bits to the left by 8 bits (thus 1 byte).
|
|
|
|
|
Cpallini already answered your question but I am curious to know why you are using ‘uint16_t’. The reason I ask is that other than making it clear that it is a 16-bit value, I can only guess why Microsoft has even defined it as a type. As you may know an ‘unsigned short’ is defined in C, and C++, as a 16-bit value and therefore redefining it makes little since to me.
Signed: Curious
|
|
|
|
|
When I click on minimize box, my CDialog derived window goes to taskbar but also ALL other thread-separated CDialog windows minimize?! How to fix it? Those thread-separated windows are modeless, created in InitInstance() of CWinThread derived class.
Thanks for help
|
|
|
|
|
By default, parent of dialog is set to NULL . Which makes application's main window as parent of dialog. Which is happening in your case.
To avoid it, you can set desktop window as parent window of dialog you dont want to minimize with main dialog. But, in this case, this dialog will appear in taskbar,too.
|
|
|
|
|
Thanks, that explains a lot. So, creating dialogs with desktop as a parent window will make those windows full separated from the application's main window? I ask because now when I create dialogs with NULL parent window, I cannot move main application's window on the top of their 'children' by activating it. It is getting the focus, titlebar is changing to active and all controls work but the window is not placed on the top of other windows. Is it also this case or something else is going on?
Thanks again
|
|
|
|
|
PatrykDabrowski wrote: Is it also this case
I dont think so.
|
|
|
|
|
I have created a class whos duty is to return a full path to the requested file. In the C'tor I allocate a string and store the exe's folder. Since strings are often returned there is a szReturnBuffer[MAX_PATH] buffer. In later calls to the methods I build a path from the earlier retrieved path and append the file/directory.
Here's the relevent code:
CGameSettings::CGameSettings( void )
{
m_szLocalDirectory = NULL;
DWORD dwLen = ::GetModuleFileName( NULL, m_szReturnBuffer, sizeof(m_szReturnBuffer) );
if ( dwLen )
{
::PathRemoveFileSpec( m_szReturnBuffer );
::PathAddBackslash( m_szReturnBuffer );
dwLen = (DWORD)_tcslen( m_szReturnBuffer ) + 1;
m_szLocalDirectory = new TCHAR [ dwLen ];
if ( m_szLocalDirectory )
_stprintf_s( m_szLocalDirectory, dwLen, _T("%s"), m_szReturnBuffer );
}
}
LPCTSTR CGameSettings::GetBkgndFolder( void )
{
if ( ! m_szLocalDirectory )
return NULL;
_stprintf_s(
m_szReturnBuffer,
sizeof(m_szReturnBuffer),
_T("%s%s"),
m_szLocalDirectory,
_T("Art\\Background\\") );
return m_szReturnBuffer;
}
m_szReturnBuffer contains the correct path, but the _stprintf_s somehow sets the m_szLocalDirectory to 0xfdfdfdfd . What could be causing this?
|
|
|
|
|
Never mind, I couldn't see the tree for the forest. I forgot to account for sizeof(TCHAR)
|
|
|
|
|
Missed by seconds !
|
|
|
|
|
WalderMort wrote: _stprintf_s( m_szReturnBuffer, sizeof(m_szReturnBuffer), _T("%s%s"), m_szLocalDirectory, _T("Art\\Background\\") );
Modify this to,
_stprintf_s(m_szReturnBuffer,sizeof(m_szReturnBuffer)/sizeof(TCHAR),T("%s%s"),m_szLocalDirectory,_T("Art\\Background\\") );
watch second parameter.
|
|
|
|
|
|
Hello,
what do i need create programs for smartphones and pocketpc(current phone Motorola A780),
what kind of developing tools i need,is VS6 ok for that, maybe i need som updates,
any book idea?
thanks in advance
break;
|
|
|
|
|
break; wrote: what kind of developing tools i need
1. ActiveSync[^]
(and)
2. C# .NET 2K3/2K5 (or) eMbedded Visual C++[^]
Nobody can give you wiser advice than yourself. - Cicero
ப்ரம்மா
|
|
|
|
|
When a Service called " A " is running in our system. I want to terminate that particular Service using the other Service name " B ". or It is possible to Terminate a Service. Kindly help in this matter.
Regards,
Chinna
-- modified at 6:22 Thursday 11th January, 2007
|
|
|
|
|
OpenService(), ControlService()
cheers,
Neil
|
|
|
|