|
What's up coders... I am interested in changing the size of the shelltraywnd so that I can have a window similar to the task bar but my own which sits at the top of the screen. Then when any other window is maximized it will think that the bottom of my new task bar or window is the top of the screen and won't go past it.
So in reality I wanna change the height that all windows maximize to on the screen. Right now the go to the top of the screen but I would like to be able to change this so that they only maximize to 200 pixels below the screen and then I can fit an application in there so it sorta simulates what the task bar is doing if it were at the top of the screen.
If anyone could help me or give me some hints as to what this would involve that would be awesome.
Peace
|
|
|
|
|
|
i , all guys here.
I confront a handicap in my VC study , and expect your help.
Now , I am writting a class inheriting CWnd . and I want my class have the function to respond the UI message such as mousedown or keydown etc.
Have some master-hands can solve this problem . If you have some sample classes that can show to me ,please email to me :polosheng@yeah.net. thanks.
Another , I have made a sample class . it can pass the complier,but when linked ,the exe file didn't respond the lbuttondown message.And here is the code. Conld you give me some suggestions?
------------------------------------------------------------------------
#if !defined(AFX_MYMSG_H__F9CB9441_F91B_11D1_8610_0040055C08D9__INCLUDED_)
#define AFX_MYMSG_H__F9CB9441_F91B_11D1_8610_0040055C08D9__INCLUDED_
#if _MSC_VER >= 1000
#pragma once
#endif // _MSC_VER >= 1000
// MyMsg.h : header file
//
#include <afxwin.h>
/////////////////////////////////////////////////////////////////////////////
// CMyMsg CWnd
class CMyMsg : public CWnd
{
DECLARE_DYNAMIC(CMyMsg)
public:
static WNDPROC m_wndProc;
public:
CMyMsg();
private:
//{{AFX_MSG(CFolderDialog)
// NOTE - the ClassWizard will add and remove member functions here.
afx_msg void OnLButtonDown( UINT nFlags, CPoint point );
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
//{{AFX_INSERT_LOCATION}}
// Microsoft Developer Studio will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_MYMSG_H__F9CB9441_F91B_11D1_8610_0040055C08D9__INCLUDED_)
------------------------------------------------------------------------------------------------------------
//implement file
#include "MyMsg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CMyMsg
IMPLEMENT_DYNAMIC(CMyMsg,CWnd)
WNDPROC CMyMsg::m_wndProc = NULL;
BEGIN_MESSAGE_MAP(CMyMsg , CWnd)
//{{AFX_MSG_MAP(CFolderDialog)
// NOTE - the ClassWizard will add and remove mapping macros here.
ON_WM_LBUTTONDOWN()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
LRESULT CALLBACK WindowProcNew(HWND hwnd,UINT message, WPARAM wParam, LPARAM lParam)
{
return CallWindowProc(CMyMsg::m_wndProc, hwnd, message, wParam, lParam);
}
CMyMsg::CMyMsg()
{
}
void CMyMsg::OnLButtonDown( UINT nFlags, CPoint point )
{
::Beep(1000,1000);
}
ignorance
|
|
|
|
|
Anybody know it ?
please give me some advise . Thank you
|
|
|
|
|
If my printer set the resolution at 300 dpi and I want to print at the other resolution. How to write code to do that?
|
|
|
|
|
does not changing the scaling mode of the print dc affect the resolution of the output?
if not then maybe you have to send some printer specific codes to the device before printing
"... and so i said to him ... if it don't dance (or code) and you can't eat it either f**k it or throw it away" sonork: 100.18128 8028finder.com
|
|
|
|
|
try to call printer dc (structure) to see printer's characteristics. if it doesn't sucessful you must change printer driver.
Good lack
|
|
|
|
|
I tried:
<br />
void CTrain1View::OnReadin() <br />
{<br />
CString sWriteText;
sWriteText="Rich text is shown here in sample project";<br />
<br />
EDITSTREAM es;<br />
es.dwCookie = (DWORD)&sWriteText;
es.pfnCallback = MEditStreamInCallback;
<br />
m_richedit.StreamIn(SF_RTF,es);
}<br />
<br />
<br />
<br />
DWORD __stdcall MEditStreamInCallback(DWORD dwCookie, LPBYTE pbBuff, LONG cb, LONG *pcb)<br />
{<br />
CString *psBuffer = (CString *)dwCookie;<br />
<br />
if (cb < psBuffer->GetLength()) cb = psBuffer->GetLength();<br />
<br />
for (int i=0;i<cb;i++)<br />
{<br />
*(pbBuff+i) = psBuffer->GetAt(i);<br />
}<br />
<br />
*pcb = cb;<br />
<br />
*psBuffer = psBuffer->Mid(cb);<br />
<br />
return 0;<br />
}<br />
<br />
but this did not populate the richedit control. Instead it crashed precisely at :
for (int i=0;i<cb;i++)<br />
{<br />
*(pbBuff+i) = psBuffer->GetAt(i);<br />
}<br />
In the debug window I could see that the entire string was retrieved, and it entered the for loop even after that. Then crashed. so is it an indexing problem? How to fix it?
Thanks,
ns
|
|
|
|
|
From the debugger, for some reason (The string is just "Rich text" with length of 9) ,I see that cb =4092, and MSDN said that the loop index is to be less than GetLength = 9. No wonder its crashing. But what is this cb thats being passed in? Helllpp!
Thank you much,
ns
|
|
|
|
|
The for loop looks bad. Did you forget to include the condition and the increment in your post? In any case, you can simply copy a CString into a char array (as it looks like what you want to do) by doing:
strcpy (pbBuff, *psBuffer->GetBuffer(0));
*psBuffer->ReleaseBuffer(); /ravi
Let's put "civil" back into "civilization"
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
Wonder why the loop got mangled in the mail
DWORD __stdcall MEditStreamInCallback(DWORD dwCookie, LPBYTE pbBuff, LONG cb, LONG *pcb)<br />
{<br />
CString *psBuffer = (CString *)dwCookie;<br />
TRACE(*psBuffer);<br />
TRACE("cb is %d",cb);
<br />
TRACE("getlength is %d",psBuffer->GetLength()); debugger says its 9, correct<br />
<br />
<br />
<br />
<br />
<br />
cb =9;<br />
<br />
TRACE("length is %d",cb);<br />
<br />
for (int i=0;i<cb;i++)<br />
<br />
<br />
{<br />
<br />
TRACE("index i is %d", i);<br />
*(pbBuff+i) = psBuffer->GetAt(i);<br />
}<br />
<br />
*pcb = cb; \\this looks weird. cb never changes....not that I can see<br />
<br />
*psBuffer = psBuffer->Mid(cb);<br />
<br />
return 0;<br />
}
I'm trying your idea now...
Thanks.
|
|
|
|
|
The for loop is
for (int i=0;i
|
|
|
|
|
i=0
i less than cb
increment i
Aaargh!
|
|
|
|
|
That's what I thought. That's a simple strcpy, so my suggestion should work.
/ravi
Let's put "civil" back into "civilization"
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
You need to surround your code with <pre> </pre>
/ravi
Let's put "civil" back into "civilization"
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
Don't forget to include "\n" at the end of your TRACE() string, otherwise you may need to cross the Atlantic to view the debugger output. Highly inconvenient.
/ravi
Let's put "civil" back into "civilization"
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
Try this:
DWORD CALLBACK _LoadRtfCallback(
DWORD dwCookie, // (in) pointer to the string
LPBYTE pbBuff, // (in) pointer to the destination buffer
LONG cb, // (in) size in bytes of the destination buffer
LONG FAR *pcb // (out) number of bytes transfered
)
{
LPCTSTR pszMsg = (LPCTSTR)dwCookie;
// number of bytes to copy
*pcb = _tcslen( pszMsg ) * sizeof(TCHAR);
// limiting it up to the buffer's size
if( *pcb > cb )
*pcb = cb;
// copying the string to the buffer
memcpy( pbBuff, pszMsg, *pcb );
// advancing to the end of the string
pszMsg += *pcb / sizeof(TCHAR);
// if it's the end of the string, returns NULL;
// otherwise, returns a pointer to the next char to transfer as the cookie
return ( *pszMsg != '\0' ) ? (DWORD)pszMsg : NULL;
}
|
|
|
|
|
I am wondering - in CRichEditStream::_LoadRtfCallback, is CRichEditStream replaced by the name of my view class? Why does this callback have a different signature type from what I see in the MSDN:
DWORD __stdcall MEditStreamOutCallback(DWORD dwCookie, LPBYTE pbBuff, LONG cb, LONG *pcb)
You have
DWORD CALLBACK _LoadRtfCallback(
DWORD dwCookie,
LPBYTE pbBuff,
LONG cb,
LONG FAR *pcb
)
Are these two forms of the function declaration equivalent? Can I use your function in conjunction with:
void CRichEgView::OnReadin()
{
CString sWriteText;
sWriteText="Rich text is shown here in sample project";
EDITSTREAM es;
es.dwCookie = (DWORD)&sWriteText;
es.pfnCallback = MEditStreamInCallback;
GetRichEditCtrl().StreamIn(SF_RTF,es);
}
What will this line be when used with your function:
es.pfnCallback = MEditStreamInCallback; // Specify the pointer to the callback function
Sorry if my questions sound naive
Thanks,
ns
|
|
|
|
|
Here is how I used it, -it ran but the box remained stubbornly blank!
void CTrain1View::OnReadin()
{
CString sWriteText;
sWriteText="Rich text is shown here in sample project";
EDITSTREAM es;
es.dwCookie = (DWORD)&sWriteText;
es.pfnCallback = _LoadRtfCallback;
m_richedit.StreamIn(SF_RTF,es);
}
DWORD CALLBACK _LoadRtfCallback(
DWORD dwCookie,
LPBYTE pbBuff,
LONG cb,
LONG FAR *pcb
)
{
LPCTSTR pszMsg = (LPCTSTR)dwCookie;
*pcb = _tcslen( pszMsg ) * sizeof(TCHAR);
if( *pcb > cb )
*pcb = cb;
memcpy( pbBuff, pszMsg, *pcb );
pszMsg += *pcb / sizeof(TCHAR);
return ( *pszMsg != '\0' ) ? (DWORD)pszMsg : NULL;
}
|
|
|
|
|
what is this:
for (int i=0;i {
*(pbBuff+i) = psBuffer->GetAt(i);
}
I am sorry but I never see that code and it pass compiler and linker. You check how look like declaration for for.
|
|
|
|
|
Hi,
I'm just starting out with Windows Sockets Programming and I'd like to know how one can choose a port number for his own server application that would not conflict with any other Internet applications running on the same computer e.g. ICQ, MSN Messenger ... etc. Also, what happens if I choose a port number that's already used on a given computer. If I enable the user to select another port number this means that any client application over the Internet will not be able to conntect to my server application. The whole idea is that I want to write a game and I want any player to be able to play against another player over the Internet (something like chess for example).
Thanx
(a.k.a. Wal2k) www.wal2k.com
|
|
|
|
|
Waleed wrote:
how one can choose a port number for his own server application that would not conflict with any other Internet applications running on the same computer e.g. ICQ, MSN Messenger ... etc.
You can't...
You can take a look at http://www.iana.org/assignments/port-numbers[^] and select a port not assigned for anything, but only use ports > 1024.
Waleed wrote:
Also, what happens if I choose a port number that's already used on a given computer.
Your socket-functions wil fail.
Waleed wrote:
If I enable the user to select another port number this means that any client application over the Internet will not be able to conntect to my server application.
That is correct, you can never know for sure that it will work on any computer, but selecting a not-assigned port it's lot likely gonna conflict with other software...
- Anders
Money talks, but all mine ever says is "Goodbye!"
|
|
|
|
|
Hi,
I am writing a callback TimerProc function inside my class with the prototype:
// Inside the CClassTimerDlg.h
public:
void CALLBACK EXPORT CClassTimerDlg::TimerProc
(
HWND hWnd, // handle of CWnd that called SetTimer
UINT nMsg, // WM_TIMER
UINT nIDEvent, // timer identification
DWORD dwTime // system time
);
// By the way, I copied this from the MSDN help
In my class implementation, I add a TimerProc as :
void CALLBACK EXPORT CClassTimerDlg::TimerProc
(
HWND hWnd, // handle of CWnd that called SetTimer
UINT nMsg, // WM_TIMER
UINT nIDEvent, // timer identification
DWORD dwTime // system time
)
{ Implementation of function TimerProc }
In one procedure handling a button inside the class, I put:
SetTimer(1,1000,TimerProc);
When I compile, I always receive the error message from the compiler for
the above line:
Error C2664: 'SetTimer' : cannot convert parameter 3
from 'void (struct HWND__ *,unsigned int,unsigned int,unsigned long)'
to 'void (__stdcall *)(struct HWND__ *,unsigned int,unsigned int,unsigned long)'
None of the functions with this name in scope match the target type
How should I declare the TimerProc to correct this problem ?
Thanks a lot
|
|
|
|
|
|
a callback guy must be global or static class function
includeh10
|
|
|
|