|
I tried doing the obvious thing, actually calling the PostMessage(WM_SIZE) from the CAppView instead of for the Main Window.
However the results were exquisite (at least I did got some results which ressembled the OnSize function executed in a distorted way).
I guess I'm way too sleepy and with a headache, I'll sleep for now and see on this tomorrow. Hopefully someone may have some light to shed
Sorry for all the annoying monologue so far hehe
|
|
|
|
|
Hello,
i like to know if someone has source code of a dock start bar like ObjectDock or MobiDock?
I would like to fix the problem with full screen games that all these bars have. Or if someone could give me hint how to program a bar like this.
With best regards
puresilence2002
|
|
|
|
|
|
My application (Doc/View) has to handle large documents and therefore I have had to implement view scrolling using the SCROLLINFO structure to take advantage of it's 32-bit capability (I'm NOT using CScrollView). I am now trying to implement auto-scrolling, where, if the mouse cursor is near the window edge, then the view scrolls automatically in that direction. My problem is that I can't find a way to determine whether the relevant scrollbar control exists, and therefore whether to enable the auto-scrolling or not - CWnd::GetScrollBarCntrl() seems to return a null pointer no matter whether the scrollbar exists or not. I must admit that I don't quite know HOW the scrollbars ARE created, as all I do is to use ::SetScrollInfo() to set the page size, document size, etc and the scroll bars magically appear when the relevant document size exceeds the corresponding window size (I don't use the window styles WS_VSCROLL or WS_HSCROLL). So my question is what test to use to determine whether scroll bars exist. Alternatively, is there a "direct" way to implement auto-scrolling which I'm not aware of ?
Doug
|
|
|
|
|
Check out my CWindowScroller article (http://www.codeproject.com/miscctrl/windowscroller.asp[^]). While it does not do exactly what you want, it does contain code on finding the existance of the scrollbars, and finding out how far the view can be scrolled.
Sonork 100.11743 Chicken Little
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
Within you lies the power for good - Use it!
|
|
|
|
|
I have checked out the refenced article and can only find the following code snippet about existance of scrollbars :-
// ensure the parent window allows vertical scrolling
CScrollBar* pBar = m_pParentWnd->GetScrollBarCtrl(SB_VERT);
BOOL bHasBar = ((pBar != NULL) && pBar->IsWindowEnabled()) || (dwStyle & WS_VSCROLL);
if (!bHasBar)
m_Alignment &= ~Vertical;
As my original posting stated, I get a null pointer returned from CWnd::GetScrollBarCtrl(), so that doesn't work in this situation. Or have I missed something else in your article ?
Doug
|
|
|
|
|
Even with a NULL pointer, the WS_VSCROLL /WS_HSCROLL style should still be set. The code checks for both.
Sonork 100.11743 Chicken Little
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
Within you lies the power for good - Use it!
|
|
|
|
|
Ahhhhhhhhhh ! I SHOULD have read that line of code more carefully - I was concentrating TOO much on getting a pointer to the scrollbar and missed the use of GetStyle() !! Thanks very much for your help - it now works, and I've learnt something (which is the bonus !)
Doug
|
|
|
|
|
Hi, I want to import data from hundreds if not thousands of password protected excel spreadsheets.
Instead of manually opening them and unprotecting them by hand, how can I modify my program, which already imports the un-protected ones, so that it can read them even tough they are password protected.
|
|
|
|
|
hi all,
I've been experimenting with device contexts and bitmaps for abt 2 weeks now. I'm having difficulty in doing the following and would like some help/advice on it.
The project i'm trying out involves splitting up a bitmap image stored locally on the hard disk into a number of blocks...16 in a 4x4 pattern. The project then involves reading each block for its HSI (hue, sat and intensity) and plotting a histogram on that. By this i basically aim to compare images based on the resulting histogram and find matches out of a database of images.
The problem i'm having is in storing the blocks in memory. The following loads the bitmap...
bool CTemp2Dlg::LoadBitmap(CString sBitmap)
{
CBitmap bmp;
CBitmap* oldBMP;
HBITMAP hBmp;
COLORREF rgb[35][35] = {0};
CString rgbHex [35][35];
CString cTemp;
//////Load Bitmap into file.....
hBmp = (HBITMAP) LoadImage(AfxGetInstanceHandle(), sBitmap, IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE);
bmp.Attach(hBmp);
bmp.GetBitmap (&stBitmap);
oldBMP = m_dcMem.SelectObject(&bmp);
.........
.........
}
m_dcMem is a CDC object defined in the class header file which is initialised as....
void CTemp2Dlg::OnInitDialog()
{
CClientDC dc(this);
m_dcMem.CreateCompatibleDC (&dc);
pDC.CreateCompatibleDC (&dc);
}
....in the OnInitDialog method. Here pDC is a CDC object to which i'm trying to copy a block into. The copy takes place as follows....
void CTemp2Dlg::GetPartOfBitmap(POINT begin, POINT end)
{
bool bError;
CBitmap bitmap;
bError = pDC->BitBlt (begin.x, begin.y, end.x - begin.x, end.y - begin.y, &m_dcMem, 0, 0, SRCCOPY);
}
....where begin and end are point structs for the block dimensions. I've found out that this copy actually doesn't copy over anything. When copied to the CPaintDC dc(this) in OnPaint() nothing comes up on screen and the HSI values for this results in garbage. I can compute the HSI values when using the m_dcMem object (which is the entire picture) but not with the pDC object. Does anyone know how do i copy over a portion of a bitmap image in a CDC object to another one..??
Thanks in advance,
Hari
|
|
|
|
|
Have a look at http://www.codeproject.com/tools/imageviewer.asp[^]. It is a tool I wrote to help me figure out these sorts of problems.
Have you selected a bitmap (drawing surface) into the pDC device context? If not, then the bitmap in the pDC will be the default 1 X 1 pixel monochrome bitmap.
Sonork 100.11743 Chicken Little
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
Within you lies the power for good - Use it!
|
|
|
|
|
i have this error :
: error C2664: 'SendMessageA' : cannot convert parameter 1 from 'char' to 'struct HWND__ *'
Conversion from integral type to pointer type requires reinterpret_cast, C-style cast or function-style cast
[code]
// Simple Sub Call
void __declspec(dllexport) TestSubb
(char& A, char& B, char& C, char& D)
{
A*= A; // handle of destination window
B*= B; // message to send
C*= C; // first message parameter
D*= D; // second message parameter
::SendMessage (A, B, C, D);
return;
}
[/code]
Why ? im missing somthing ?
i cant get this to work
help p:
jeroen
|
|
|
|
|
The prototype of SendMessage is the following:
LRESULT SendMessage(<br />
HWND hWnd,
UINT Msg,
WPARAM wParam,
LPARAM lParam
);
you use wrong data types.
Greetings,
D.
|
|
|
|
|
Deian :
you use wrong data types.
Do need other data types ?
Can you be more Specific (more detailed)
im programming visual basic, im new with C++
Thanks for help
Jeroen
|
|
|
|
|
you pass 4 char* to SendMessage
but it does not take such parameters..(check the declaration Deian sent..
As you work in VB..imagin passing a string parameter "ABC" to a function that takes Long or integer..
An error will occur.
|
|
|
|
|
Whats the best way to store data against custom controls such as the font in use? Should I reserve extra bytes when registering the class or allocate a block of memory when I receive the WM_CREATE message and attach it to the window using SetProp()? Any suggestions will be gratefully received.
Systems AXIS Ltd - Software for Business ...
|
|
|
|
|
I'd suggest SetProp. I recently had to deal with a custom control that I tried to wrap into a .NET control using subclassing. Nothing worked till I realized that it used the extra bytes in the window class. Since I wasn't using it's windows class, but subclassing an existing window, it worked best by changing the code to use SetProp.
That's my 2 cents, anyways.
--
Joel Lucsy
|
|
|
|
|
how do i create a dll file for compatability with either Java or Visual Basic
|
|
|
|
|
Search: C++ visual basic Dll
|
|
|
|
|
Yea thanks but none of them told me dow to get started
|
|
|
|
|
|
|
|
how do i create a exe file Visual C++ that detects the name of a file that is draged over it
Clint
|
|
|
|
|
Have a look at IDropTarget. There is a sample program on MSDN somewhere.
Systems AXIS Ltd - Software for Business ...
|
|
|
|