|
I have been asked to provide a spin control for a tab control which has the standard 'left/right' buttons and also 'first/last' button. Without having to implement a fully owndrawn tab control.
Any suggestions would be gratefully appreciated.
|
|
|
|
|
Hi, In Developer Studio (VC++ ver 4.0),I used to have an "H" button (to switch to the respective header file) above the workspace source file window. It seems to have disappeared recently, and I don't know how to get it back again !!! Anybody got any idea on how I do this ??? (I can't see anythingin "Help" that covers this - most annoying !!!)
Doug
|
|
|
|
|
O.K. -within 2 minutes of posting this message, I solved my own problem !!! (typical !) The .clw file was missing - when I had recreated it, the "H" button reappeared magically !! (Hope this may be of some help to someone in the future !)
Doug
|
|
|
|
|
I have an application based on the CListView class, and I'd like to do the following: when a user resizes the frame of my application, I'd like the columns in the list view to resize themselves appropriately. My problem is that I'm a little confused as to when (and where) I do this.
Currently, I am handling the WM_SIZE method in the view class. Here is the code I'm using (in the OnSize() method):
CListView::OnSize(nType, cx, cy);
if(m_List->GetSafeHwnd() != NULL)
{
CRect rectList;
m_List->GetClientRect(&rectList);
int listwidth = (rectList.Width() - GetSystemMetrics(SM_CXVSCROLL));
int nColInterval = listwidth / 10;
m_List->SetColumnWidth(0, 4 * nColInterval);
m_List->SetColumnWidth(1, listwidth - (4 * nColInterval));
} I have several problems with this code. When the vertical scroll bar actually does appear, the column sizes aren't quite right. I want a space in the header control for the vertical scroll bar's top arrow (hence the GetSystemMetrics() call above). But when the vertical scroll bar shows up, it looks like twice the distance is inserted in the header control.
Another problem is that when I switch from any non-details view to the details view, the size is not updated initially. So, for example, if I'm in "Large Icons" mode and resize the window, then switch to "Details" mode, the columns are sized for the previous window size, not the current size.
Can anyone shed any light on what I should do for this? Any help would be greatly appreciated!
Thanks,
Jonah Bishop
Visit JGB Productions
|
|
|
|
|
|
Hello,
I have a problem in win32 app.
How can I use MFC Great classes in win32 application ?
They conflict in header file: "afx.h" & "windows.h"
Thank for your response
|
|
|
|
|
|
Thank you Nishant
|
|
|
|
|
The release exe works fine. The debug is crashing at the calll to CDialog Create()
BOOL CDisplayInfoList::Create(UINT nID, CWnd *pWnd, const CString* keys, int keysSize, std::set<CString>* pKeySet)
{
m_pParentWnd = pWnd;
m_pKeySet = pKeySet;
m_allKeysArray = new CString [keysSize];
m_arraySize = keysSize;
for (int i =0; i < keysSize; i++)
{
m_allKeysArray[i] = keys[i];
}
<code>return CDialog::Create( nID,pWnd);</code>
}
Its just a popup resizing dialog with a clistctrl and two buttons.
What shall I suspect? THe call is :
CDisplayInfoList* pDisplayInfoList = new CDisplayInfoList;
if (pDisplayInfoList == NULL) return;
<code> BOOL ret = pDisplayInfoList->Create(IDD_DISPLAYINFOLIST, this, goodFields, flds.size() ,&(pDoc->m_keySet));</code> if(!ret)
{
AfxMessageBox("Error creating viewbox");
delete pDisplayInfoList;
return;
}
winocc.cpp line 259, where its saying its not IsWindow:
int CWnd::GetDlgCtrlID() const
{
ASSERT(::IsWindow(m_hWnd));
|
|
|
|
|
sorry its line 279...in
void CWnd::MoveWindow(int x, int y, int nWidth, int nHeight, BOOL bRepaint)
{
ASSERT(::IsWindow(m_hWnd));
if (m_pCtrlSite == NULL)
::MoveWindow(m_hWnd, x, y, nWidth, nHeight, bRepaint);
else
m_pCtrlSite->MoveWindow(x, y, nWidth, nHeight, bRepaint);
}
and stops in this if I set a breakpoint in it....
|
|
|
|
|
I made a new identical class but named its resource and classname shorter. One of the two factors (maybe both) made the debug version happy too. I didnt realize there was a limit to the length of the names????
|
|
|
|
|
Hi everyone!
I'm creating a Dialog based Win32 Application. One of my controls is a picture control.
How can i load and display an image(bitmap) on this control???
Should I subclass the picture control???
Please send an example if you can!...
Thanks!!!
|
|
|
|
|
If the bitmap is in the program resources you just set the "type" (in its properties) to Bitmap then choose the bitmap id from the "image" field.
If you need to load images using code this is a sample code for loading a bitmap from file into a static control (picture control is actually a static control with SS_BITMAP style).
The code assume that you have a picture control with ID IDC_MYPICTURE (if you left the default ID, IDC_STATIC, the code will fail) and styles set to real image size (SS_REALSIZEIMAGE ) and type is bitmap (SS_BITMAP ).
HBITMAP hBmp = (HBITMAP)LoadImage(NULL, fileName, IMAGE_BITMAP,
0, 0, LR_LOADFROMFILE | LR_DEFAULTSIZE);
CStatic * pStatic = NULL;
pStatic = ((CStatic*)GetDlgItem(IDC_MYPICTURE));
if(hBmp && pStatic)
{
HBITMAP hOldBmp = pStatic->GetBitmap();
DeleteObject(hOldBmp);
pStatic->SetBitmap(hBmp);
}
|
|
|
|
|
Could you please tell me how to do that in win32 API???
|
|
|
|
|
Sorry, did not notice.
This is the same code but using Win32 APIs:
HBITMAP hBmp = (HBITMAP)LoadImage(NULL, fOpen.GetPathName(), IMAGE_BITMAP,
0, 0, LR_LOADFROMFILE | LR_DEFAULTSIZE);
HWND hWnd = ::GetDlgItem(hDlg, IDC_MYPICTURE);
if(hBmp && hWnd)
{
HBITMAP hOldBmp =
(HBITMAP) ::SendMessage(hWnd, STM_GETIMAGE, IMAGE_BITMAP, 0);
if(hOldBmp)
DeleteObject(hOldBmp);
::SendMessage(hWnd, STM_SETIMAGE, IMAGE_BITMAP, (LPARAM)hBmp);
}
|
|
|
|
|
|
hey....you can do it with SetBitmap() function of CStatic class.
C.R.Naik
|
|
|
|
|
is there any way to create instances of classes indirectly
for example in
myClass myObject;
or
myObject = new myClass;
is there a way i could make myClass a variable containing the name (or something) of the class i wanted the item to be.
I would like to be able to get away from this unfortunate and annoying hardcoding of class creation, but i dont have a clue how to do it
Any Ideas???
|
|
|
|
|
Chicken64 wrote:
I would like to be able to get away from this unfortunate and annoying hardcoding of class creation, but i dont have a clue how to do it
Not sure if this is what you want. But take a look at :- Accessing Run-Time Class Information on MSDN. If you don't find that search for RUNTIME_CLASS macro
Nish
Author of the romantic comedy
Summer Love and Some more Cricket [New Win]
Review by Shog9
Click here for review[NW]
|
|
|
|
|
Chicken64 wrote:
is there a way i could make myClass a variable containing the name (or something) of the class i wanted the item to be.
some languages allow this, but C++ isn't one of them.
the best you can do is to create a "class factory" where you can do something like:
CBaseClass * pObj = factory.MakeNewObjectFromName(csClassName);
and that function would have to compare csClassName to a set of names.
using COM, you can get more abstract, since the list of names is dynamic (UUIDs and CLSIDs) and maintained by the OS. all you have to do is come up with a way to tie the object you want to create to the list of names/IDs that the OS maintains. it can get complicated.
-c
When history comes, it always takes you by surprise.
|
|
|
|
|
thanks for the help, i guess its good to know it cant be done (stops me trying to figure out how to do it)
oh well, i might well try that class factory thing
thanks again, Chicken64
|
|
|
|
|
I want to hook the createfile API.
Whenever a file is being created or modified i need to receive the alert so that i can check who is creating/modifying the file..after i verify the user and his quota..then i can allow creating the file or deny his request.
ANY idea on how to do this???
Ill be forever grateful to anybody who helps!!
|
|
|
|
|
|
in MSDN search :
Monitoring Changes in a Directory or Directory Tree..
this allows u just to monitor changes. not to make you allow it or not
|
|
|
|
|
Hi
I'm using FindNextFile() to extract file.Problem is i need to extract them in numerical order.I had ordered them proper through Windows explorer, but it seems that FindNextFile() doesnt retrieve the files in that order. Is it not supposed to retrieve the files in order?
Is there any way i can retrieve the files in order?
thks
|
|
|
|