|
Hi, I have a custom CTreeCtrl, the problem is that the HScrollbar is not more working correctly, because the rect of the item insert in the tree is different than the rect that i use paint. So i tried to implement my own HScrollfunction, i know the item length, and can set the Scrollbar with SetScrollInfo, that works perfectly i can also calculate the offset to scroll. I use the customdraw function to scroll the screen with setWindowOrg(xOffset,yOffset). As next i can catch nearly all mouse events and also set an offset, i have only one problem with the TVS_HASBUTTONS that is not working correctly (The offset i calculate has no influence), any idea why? Or is there another way to scroll, a custom treectrl? Is it not possible just to change the item length somehow? So the windows standard behavier of the treectrl would do the scrolling for me?
I would be happy for any help or ideas...
|
|
|
|
|
In VC,why I cannot open the project of CDex downloaded from "http://sourceforge.net/" ? Thank you first.
Rap off for you,for me,for our human.
|
|
|
|
|
maybe u have the wrong version of vc?
i can't open it either with .net 2002.
Don't try it, just do it!
|
|
|
|
|
I am using the VC6.0.
Is the reason the version???
If so,which version of VC can open it???
Rap off for you,for me,for our human.
|
|
|
|
|
How to capture the status that's getting displayed in command window(local system only) from another windows application..... any ideas????
thanks in advance
adi
|
|
|
|
|
Make the output text of that console app into a disk file instead of printing to the command window, and then read the contents of the file into a memory buffer and parse that buffer for your needs...
But how to do this in your program? here's a solution:
Dynamically generate a .BAT batch file in your program, the contents of this batch file is like this:
consoleApp.exe >> c:\output.txt
Here, consoleApp.exe is the filename of that console app you want to capture its output, and then launch this batch file via CreateProcess win32 API. After the end of console app, what its outputs are placed into the output.txt file...
Hope this helps.
|
|
|
|
|
I have post this Q on some message boards and I didd not get a god answer yet.
I'm writing a game server that has the incoming data on tcp and outgoing on UDP muticast. My questiisn is.
Is UDP muticast rerouted on the WAN (internet) or not.
Thanks.
|
|
|
|
|
internet does not support multicast!
Don't try it, just do it!
|
|
|
|
|
Every application (windows) has .rc file and corresponding resource.h file is there any way we can give the resource.h a different name and the classwizard will do any further modifcations of the resource to new .h file?
Thanx in advance.
Prakash.
My God is more powerfull Than Your God.
|
|
|
|
|
i don't know a method, but why do u need to rename it?
Don't try it, just do it!
|
|
|
|
|
I have a function written to switch views. I have created a menu item that has two sub menu. when the application is run the default dailog comes up. when i try to switch to the other view it is not working.
here is the code for switching the view.
void CMainFrame::SelectView(int viewID)
{
// CFrameWnd* pMainWnd = (CFrameWnd*)AfxGetMainWnd();
CView* pOldActiveView = GetActiveView(); // Get current view
// Get pointer to new view if it exists
// if it doesn't the pointer will be null
CView* pNewActiveView = (CView*) GetDlgItem(viewID);
// CView* pNewActiveView = static_cast<cview*>(GetDlgItem(viewID));
// If this is 1st time around for the new view,
// the new view won't exist, so we must create it
if (pNewActiveView == NULL)
{
switch(viewID)
{
case PEOPLEVIEW: // Create a People view
pNewActiveView = (CFormView*)new CPeople;
//pNewActiveView = (CView*)new CPeople;
break;
case RELATIONVIEW: // Create a Relationship view
pNewActiveView = (CView*)new CRelation;
//pNewActiveView = (CView*)new CRelation;
break;
default:
AfxMessageBox("Invalid View ID");
return;
}
// Switching the views
// Obtain the current view context to apply to the new view
CCreateContext context;
context.m_pCurrentDoc = pOldActiveView->GetDocument();
pNewActiveView->Create(NULL, NULL, 0L, CFrameWnd::rectDefault,this, viewID, &context); // the program exits with an error at this point. please help me solve this
pNewActiveView->OnInitialUpdate();
}
// Check whether there are any orders
SetActiveView(pNewActiveView); // Activate the new view
pOldActiveView->ShowWindow(SW_HIDE); // Hide the old view
pNewActiveView->ShowWindow(SW_SHOW); // Show the new view
pOldActiveView->SetDlgCtrlID(m_CurrentViewID); // Set the old view ID
pNewActiveView->SetDlgCtrlID(AFX_IDW_PANE_FIRST);
m_CurrentViewID = viewID; // Save the new view ID
RecalcLayout();
}
|
|
|
|
|
I believe you need to at least specify WS_CHILD for the style, probably WS_VISIBLE as well so you can see it.
--
Joel Lucsy
|
|
|
|
|
This is how I do it.
I have two functions, one to create/add a new view to my app and the other to swap the views
void AddView(CWnd* pMainWnd, CView* pView, UINT nID)
{
CDocument* pCurrentDoc = ((CFrameWnd*) pMainWnd)->GetActiveDocument();
CCreateContext newContext;
newContext.m_pNewViewClass = NULL;
newContext.m_pNewDocTemplate = NULL;
newContext.m_pLastView = NULL;
newContext.m_pCurrentFrame = NULL;
newContext.m_pCurrentDoc = pCurrentDoc;
CRect rect(0,0,0,0);
char szTemp[64];
sprintf(szTemp, "ViewList%x", nID);
pView->Create(NULL, NULL,
(AFX_WS_DEFAULT_VIEW & ~WS_VISIBLE),
// views are created with the style of AFX_WS_DEFAULT_VIEW
// In MFC 4.0, this is (WS_BORDER | WS_VISIBLE | WS_CHILD)
rect, pMainWnd,
nID, &newContext);
pView->SendMessage(WM_INITIALUPDATE, 0, 0);
}
CView* SwitchView(CFrameWnd* pFrame, CView* pNewView)
{
CView* pActiveView = pFrame->GetActiveView();
UINT temp = ::GetWindowLong(pActiveView->m_hWnd, GWL_ID);
::SetWindowLong(pNewView->m_hWnd, GWL_ID, temp);
if(pActiveView == pNewView)
return pActiveView;
// Resize new view to fit the frame - bug fix MB 14/03/02
CRect rect;
pFrame->GetClientRect(&rect);
pNewView->MoveWindow(&rect);
pActiveView->ShowWindow(SW_HIDE);
pFrame->RecalcLayout();
pFrame->SetActiveView(pNewView);
pNewView->ShowWindow(SW_SHOW);
pNewView->Invalidate();
return pActiveView;
}
// Each view needs an ID
#define VIEWS_CALLLIST_VIEW AFX_IDW_PANE_FIRST
#define VIEWS_TRANSFER_VIEW AFX_IDW_PANE_FIRST + 1
// In the WinApp derived class, create the views
void CReceptionApp::SetupViews()
{
// Get the primary view
CView* pActiveView = ((CFrameWnd*) m_pMainWnd)->GetActiveView();
m_pReceptionView = (CReceptionView*) pActiveView;
// Create the second view
m_pTransferView = new CTransferView;
AddView(m_pMainWnd, m_pTransferView, VIEWS_TRANSFER_VIEW);
}
// Switch the view - I usually call this in the CMainFrame class
SwitchView(this, GetApp()->GetTransferView());
Michael
|
|
|
|
|
Hi,
Whenever a pointer is not allocated, something like this,
CClass *myObj;
It is pointing to some address like 0xccddff.
I know that the address is junk. Why it is always like 0xccdeff or 0xdeffcc?? Why it is not like 0x102033??
So, before allocation of memory it is pointing to some place, which is junk. But, where is that junk area? or which is the area used where the not allocated pointer points to?
Best Regards,
A.Ilamparithi
|
|
|
|
|
The compiler sets this up for you (in debug builds only) so that you can find bugs quickly if you accidentally use the pointer without initializing it. It also does a similar thing with dynamically allocated blocks of memory.
Lets be honest, isn't it amazing how many truly stupid people you meet during the course of the day. Carry around a pad and pencil, you'll have twenty or thirty names by the end of the day - George Carlin
Awasu 1.1.4 [^]: A free RSS reader with support for Code Project.
|
|
|
|
|
|
Hello, i've got a problem with a Combobox as dropdown! If I have changed the Edit Control, I would paste the EnterKey! I have no reaction! How I can find the VK_RETURN ?
please help
|
|
|
|
|
Umm..
You have a combobox with the 'dropdown' style set. That far I understand. Beyond this sentence your description of the problem becomes simply too illogical to understand. In english: your typing sucks big time
Could you clarify a bit ? What is it that you are actually trying to accomplish ? Must the edit control attached to the combo box be able to handle return keypresses ?
"You cannot paste a 'EnterKey'" That makes no sense. Are you, per chance, willing to paste a string into the edit control, and this string contains a LF-CR (line feed - carriage return) pair or line change formatting ('\n') ?
The more in detail and clearly you can describe your problem, the more better we can help you. Always when posting a message, remember to check it for spelling errors or typoes. A typo can change the context of a sentence completely, making us misunderstand you completely.
-Antti Keskinen
----------------------------------------------
The definition of impossible is strictly dependant
on what we think is possible.
|
|
|
|
|
Ok,
also i have a list ! Bsp: 1
3
25
76
111
546
3333
4711
Then i change manuell the entry! Bsp 56 then i hit "Enter"! -> then i want start onaccept! If then manuell entry not in List! Messagebox: Entry not in List!
else setCursel manuell entry!
.....
|
|
|
|
|
OK I think I know what you're on about.
You can override the CBN_SELCHANGE message for your combobox using ClassWizard (VS6). This will create the OnSelChangeXXX() function handler that gets called wheneveer your user selects a new item from your combo control, or types in a new entry.
You can then use this handler to determine if the entry is already in your list, or not (Where you wanted to popup a message box).
Another way would probably be to set the CBS_DROPDOWNLIST style programatically, or via the resource editor. This will force the user to select items that are in the list instead of entering their own items.
Hope this helps.
I Dream of Absolute Zero
|
|
|
|
|
Can i open the select list when everyone change the edit control?
OnEditChange() ?
When the selectlist is open, the Enterkey is OK!
|
|
|
|
|
Now you've lost me again!
those automated translators are a b*tch aren't they?
I Dream of Absolute Zero
|
|
|
|
|
Referring to the MSDN, there is no prepared override which allows you to hack into the message stream of a combo box.
However, there is a way. It requires that you derive a new class from CComboBox, and put a message map entry for 'ON_WM_CHAR' messages. Route these messages to a handler function, and if the message contains the virtual key VK_RETURN, you start the copying routine.
In this routine, you first use GetWindowText to get the current text in the combo box's edit control. Then you use a combination of GetCurSel , DeleteString and InsertString methods to replace the currently selected string with the new string you typed in.
The default handler of the VK_RETURN keypress attempts to search for the inserted string in the list. You must override this handler in order to implement custom functionality. Remember to call the base class handler for other keypresses, otherwise your combo box might not work properly.
-Antti Keskinen
----------------------------------------------
The definition of impossible is strictly dependant
on what we think is possible.
|
|
|
|
|
Ok I have forgotten to say, if the entry correct send a message to a server!
Update the Database about time and Date!
I have a subclass DCCombobox!
/* --------------------------------------------------------------------
* Message-Map definieren
* ------------------------------------------------------------------
*/
BEGIN_MESSAGE_MAP(DCComboBox, CComboBox)
ON_WM_KEYUP()
ON_WM_KEYDOWN()
END_MESSAGE_MAP()
int DCComboBox::OnCreate( LPCREATESTRUCT lpCreateStruct ){
return CComboBox::OnCreate(lpCreateStruct);
}
void DCComboBox::OnKeyDown(UINT nChar,UINT nRepCnt,UINT nFlags ) {
CWnd* parent = GetParent();
if( parent )
parent->PostMessage( WM_KEYDOWN,(WPARAM)nChar,
MAKELONG (nRepCnt,nFlags) );
CComboBox::OnKeyDown(nChar,nRepCnt,nFlags);
}
void DCComboBox::OnKeyUp(UINT nChar,UINT nRepCnt,UINT nFlags ) {
CWnd* parent = GetParent();
if( parent )
parent->PostMessage( WM_KEYUP, (WPARAM)nChar,
MAKELONG(nRepCnt,nFlags) );
CComboBox::OnKeyUp(nChar,nRepCnt,nFlags);
}
|
|
|
|
|
You're simply not making any sense. I am completely loss of what you are trying to do.
Ask a friend of yours to do an accurate translation of what you want to do and post that as a message. Otherwise we cannot help you any further, as we can't understand your motives at all.
The code you posted works correctly, as far as I can tell: it posts a message to the parent window when a keyboard event is received in the combo box control. Is this what you wanted to do ?
What is this 'send a message to server' ? What server ? Time ? Date ?? Database ??? You've completely shaken us. Start forming your problem anew, and this time ask a friend who has qualified english skills to translate it for you, so it will be easier for us to read.
-Antti Keskinen
----------------------------------------------
The definition of impossible is strictly dependant
on what we think is possible.
|
|
|
|
|