|
Hello. Does anyone know how to code a Auto-Entry CDataCombo. CDataCombo is an Active X control. I created a auto-completing CCombobox and made my CDataCombo inherit from it. However, it does not behave the same way. For example when I invoke ShowDropDown(), my CDataCombo does not respond. Any thoughts, please help.
Roshan Haridas
Software Programmer
Exeltech
|
|
|
|
|
If the constant MECHANICAL was defined in the main class, I remove a menu item in InitInstance(). Now at the start of the application, the menu does get deleted. But when I go to File->New, the deleted menu reappears. How do I stop it from re-appearing? Thanks!
//MainApp
#define MECHANICAL
//In main app in function InitInstance()
#ifdef MECHANICAL
pMainFrame->OnChangeFileMenu();
#endif
void CMainFrame::OnChangeFileMenu()
{
CWnd* pMain = AfxGetMainWnd();
// Get the menu from the application window.
CMenu* mmenu = pMain->GetMenu();
// Look for "Tools" menu.
int pos = FindMenuItem(mmenu, &Tools");
if (pos > -1)
mmenu->DeleteMenu(pos, MF_BYPOSITION);
pMain->DrawMenuBar();
}
int CMainFrame::FindMenuItem(CMenu *menu, LPCTSTR menustr)
{
ASSERT(menu);
ASSERT(::IsMenu(menu->GetSafeHmenu()));
int count = menu->GetMenuItemCount();
for (int i = 0; i < count; i++)
{
CString str;
if (menu->GetMenuString(i, str, MF_BYPOSITION) &&
(strcmp(str, menustr) == 0))
return i;
}
return -1;
}
|
|
|
|
|
What am I trying to do....
Using VC++ 6 and MFC
The application does several things. It receives 3 threads of information via a TCP/IP connection. It also monitors a directory for new files. All of the data is processed and logged as it is received. A worker thread handles the multiple threads.
A dialog box interface will be used to display a summary of the information. The dialog needs to be a property sheet (tab dialog) with a summary page listing all data from all sources. The other tabs are more detailed breakdowns of each type of data.
My problem is...
So far, I have been using a list control on each tab for the data display. However, I can't figure out how to get the data to display in the list.
If I create a list box on the main dialog, I can use AddString or InsertItem just fine. But when I try to do the same with my property pages it doesn't work.
Please help.
<br />
#include "stdafx.h"<br />
#include "tryproppage.h"<br />
#include "tryproppageDlg.h"<br />
#include "MyPage1.h"<br />
#include "MyPage2.h"<br />
<br />
HWND hwndTPPDlg;<br />
<br />
<br />
CTryproppageDlg::CTryproppageDlg(CWnd* pParent )<br />
: CDialog(CTryproppageDlg::IDD, pParent)<br />
{<br />
m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);<br />
}<br />
void CTryproppageDlg:oDataExchange(CDataExchange* pDX)<br />
{<br />
CDialog:oDataExchange(pDX);<br />
}<br />
BEGIN_MESSAGE_MAP(CTryproppageDlg, CDialog)<br />
END_MESSAGE_MAP()<br />
<br />
<br />
BOOL CTryproppageDlg::OnInitDialog()<br />
{<br />
CDialog::OnInitDialog();<br />
<br />
static CPropertySheet myPropSheet;<br />
static CMyPage1 myPage1;<br />
static CMyPage2 myPage2;<br />
myPropSheet.AddPage(&myPage1);<br />
myPropSheet.AddPage(&myPage2);myPropSheet.Create();<br />
myPage1.m_listctrl1.InsertItem(0,"stuff");<br />
return TRUE;
}<br />
_________________________________________________________________<br />
<br />
<br />
#include "stdafx.h"<br />
#include "tryproppage.h"<br />
#include "tryproppageDlg.h"<br />
<br />
<br />
BEGIN_MESSAGE_MAP(CTryproppageApp, CWinApp)<br />
ON_COMMAND(ID_HELP, CWinApp::OnHelp)<br />
END_MESSAGE_MAP()<br />
<br />
CTryproppageApp::CTryproppageApp()<br />
{<br />
}<br />
CTryproppageApp theApp;<br />
BOOL CTryproppageApp::InitInstance()<br />
AfxEnableControlContainer();<br />
<br />
CTryproppageDlg dlg;<br />
m_pMainWnd = &dlg;<br />
int nResponse = dlg.DoModal();<br />
if (nResponse == IDOK)<br />
{<br />
}<br />
else if (nResponse == IDCANCEL)<br />
{<br />
}<br />
return FALSE;<br />
}<br />
<br />
<br />
_________________________________________________________________<br />
<br />
#include "stdafx.h"<br />
#include "tryproppage.h"<br />
#include "MyPage1.h"<br />
<br />
<br />
IMPLEMENT_DYNCREATE(CMyPage1, CPropertyPage)<br />
<br />
CMyPage1::CMyPage1() : CPropertyPage(CMyPage1::IDD)<br />
{<br />
}<br />
<br />
CMyPage1::~CMyPage1()<br />
{<br />
}<br />
<br />
void CMyPage1:oDataExchange(CDataExchange* pDX)<br />
{<br />
CPropertyPage:oDataExchange(pDX);<br />
DDX_Control(pDX, IDC_LIST_CTRL1, m_listctrl1);<br />
}<br />
<br />
<br />
BEGIN_MESSAGE_MAP(CMyPage1, CPropertyPage)<br />
ON_BN_CLICKED(IDC_BUTTON1, OnButton1)<br />
END_MESSAGE_MAP()<br />
<br />
<br />
BOOL CMyPage1::OnInitDialog() <br />
{<br />
CPropertyPage::OnInitDialog();<br />
return TRUE; <br />
}<br />
<br />
_________________________________________________________________<br />
<br />
<br />
class CMyPage1 : public CPropertyPage<br />
{<br />
DECLARE_DYNCREATE(CMyPage1)<br />
<br />
public:<br />
CMyPage1();<br />
~CMyPage1();<br />
<br />
enum { IDD = IDD_PAGE1 };<br />
CListCtrl m_listctrl1;<br />
<br />
<br />
protected:<br />
virtual void DoDataExchange(CDataExchange* pDX);
<br />
protected:<br />
virtual BOOL OnInitDialog();<br />
DECLARE_MESSAGE_MAP()<br />
<br />
};<br />
<br />
MyPage2 is identical to MyPage1
|
|
|
|
|
realius wrote:
BOOL CTryproppageDlg::OnInitDialog()
{
CDialog::OnInitDialog();
static CPropertySheet myPropSheet;
static CMyPage1 myPage1;
static CMyPage2 myPage2;
myPropSheet.AddPage(&myPage1);
myPropSheet.AddPage(&myPage2);myPropSheet.Create();
myPage1.m_listctrl1.InsertItem(0,"stuff");
return TRUE; // return TRUE unless you set the focus to a control
}
This seems very odd to me. Even though CPropertySheet is not derived from CDialog , it is managed in a similar fashion. I would suggest deriving CTryproppageDlg from CPropertySheet . Add a CPropertyPage member variable for each tab required. In CTryproppageDlg 's constructor, call AddPage() for each of those member variables. In each of the tab's OnInitDialog() method, call CListCtrl::InsertColumn() . Then populate the controls as necessary. Thus should be a much cleaner approach.
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
I'm trying to set the height of a combobox (as opposed to the height of the dropdown list), but I just can't seem to find any quick fix for it on the net.
Is there a quick fix?
--
Schni Schna Schnappi! Schnappi Schnappi Schnapp!
|
|
|
|
|
|
Yes I did. But the thing is that comboboxes are bastardizations, and doesn't deserve to be called windows. You can tell it's an OLD OLD hack from the Win 3.x-era (probably 2.x), that's been kept alive due to legacy reasons.
I found the workaround after a good nights sleep. Apparently googling becomes increasingly difficult as you become more tired. Anyway, the solution to the problem (I also found this in the MSDN docs this morning): SetItemHeight(-1, nYourHeight);
Henceforth, I will call this control: "ugly bag of mostly hacks".
--
Schni Schna Schnappi! Schnappi Schnappi Schnapp!
|
|
|
|
|
Hi Guys I have been banging my head against the wall for some time.Please Help...
I have downloaded an example in C#.NET and have made some conversion that have worked
in my C++.NET winform application. Does anyone have any ideas?
The last line does not work.......
// get the collection of sheets in the workbook
//C# example
// Excel.Sheets sheets = theWorkbook.Worksheets;
// This conversion works
Interop::Excel::Sheets *sheets = theWorkbook->Worksheets;
//C# example
// Excel.Worksheet worksheet = (Excel.Worksheet)sheets.get_Item(1);
// This does not work..it is looking for a
// error C2664: 'Interop::Excel::Sheets::get_Item' : cannot convert parameter 1 from 'int'
// to 'System::Object __gc *'
Interop::Excel::Worksheet *worksheet = (Interop::Excel::Worksheet*)sheets->get_Item(1);
|
|
|
|
|
I'm trying to find a way to detect the type of bus connection a video card has, programatically of course. Valid types being PCI, AGP, and PCI-Express. And of course that bus's speed would be nice too, like 8x, 16x, etc. I've been searching everywhere and tried many things, including WMI which doesn't have that information.
Any ideas are much appreciated!
umgoblue525
|
|
|
|
|
Hi,
For quite long time now I've been trying to get the Crypto++ (www.cryptopp.com) library working with a simple MFC Dialog Based application.
The strange thing is that a Win32 console application links and works fine with the same settings :-|
Here are the errors I'm getting:
--------------------Configuration: dialog - Win32 Debug--------------------
Linking...
LINK : warning LNK4049: locally defined symbol ""public: __thiscall std::ios_base::Init::Init(void)" (??0Init@ios_base@std@@QAE@XZ)" imported
LINK : warning LNK4049: locally defined symbol ""public: __thiscall std::ios_base::Init::~Init(void)" (??1Init@ios_base@std@@QAE@XZ)" imported
LINK : warning LNK4049: locally defined symbol ""public: __thiscall std::_Winit::_Winit(void)" (??0_Winit@std@@QAE@XZ)" imported
LINK : warning LNK4049: locally defined symbol ""public: __thiscall std::_Winit::~_Winit(void)" (??1_Winit@std@@QAE@XZ)" imported
LINK : warning LNK4049: locally defined symbol ""public: __thiscall std::basic_string<char,struct std::char_traits<char="">,class std::allocator<char> >::~basic_string<char,struct std::char_traits<char="">,class std::allocator<char> >(void)" (??1?$basic_s
tring@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@XZ)" imported
LINK : warning LNK4049: locally defined symbol ""public: __thiscall std::basic_string<char,struct std::char_traits<char="">,class std::allocator<char> >::basic_string<char,struct std::char_traits<char="">,class std::allocator<char> >(char const *,class st
d::allocator<char> const &)" (??0?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@PBDABV?$allocator@D@1@@Z)" imported
LINK : warning LNK4049: locally defined symbol ""public: __thiscall std::basic_string<char,struct std::char_traits<char="">,class std::allocator<char> >::basic_string<char,struct std::char_traits<char="">,class std::allocator<char> >(class std::basic_stri
ng<char,struct std::char_traits<char="">,class std::allocator<char> > const &)" (??0?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@ABV01@@Z)" imported
LINK : warning LNK4049: locally defined symbol ""public: char const * __thiscall std::basic_string<char,struct std::char_traits<char="">,class std::allocator<char> >::c_str(void)const " (?c_str@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@st
d@@QBEPBDXZ)" imported
libcpmtd.lib(xstrcoll.obj) : error LNK2001: unresolved external symbol ___setlc_active
libcpmtd.lib(_tolower.obj) : error LNK2001: unresolved external symbol ___setlc_active
libcpmtd.lib(_toupper.obj) : error LNK2001: unresolved external symbol ___setlc_active
libcpmtd.lib(xwctomb.obj) : error LNK2001: unresolved external symbol ___setlc_active
libcpmtd.lib(xmbtowc.obj) : error LNK2001: unresolved external symbol ___setlc_active
libcpmtd.lib(xstrcoll.obj) : error LNK2001: unresolved external symbol ___unguarded_readlc_active
libcpmtd.lib(_tolower.obj) : error LNK2001: unresolved external symbol ___unguarded_readlc_active
libcpmtd.lib(_toupper.obj) : error LNK2001: unresolved external symbol ___unguarded_readlc_active
libcpmtd.lib(xwctomb.obj) : error LNK2001: unresolved external symbol ___unguarded_readlc_active
libcpmtd.lib(xmbtowc.obj) : error LNK2001: unresolved external symbol ___unguarded_readlc_active
libcpmtd.lib(xstrcoll.obj) : error LNK2001: unresolved external symbol ___lc_handle
libcpmtd.lib(_tolower.obj) : error LNK2001: unresolved external symbol ___lc_handle
libcpmtd.lib(_toupper.obj) : error LNK2001: unresolved external symbol ___lc_handle
libcpmtd.lib(xwctomb.obj) : error LNK2001: unresolved external symbol ___lc_handle
libcpmtd.lib(xmbtowc.obj) : error LNK2001: unresolved external symbol ___lc_handle
libcpmtd.lib(_tolower.obj) : error LNK2001: unresolved external symbol __pctype
libcpmtd.lib(_toupper.obj) : error LNK2001: unresolved external symbol __pctype
libcpmtd.lib(xmbtowc.obj) : error LNK2001: unresolved external symbol __pctype
libcpmtd.lib(wlocale.obj) : error LNK2001: unresolved external symbol ___mb_cur_max
libcpmtd.lib(_tolower.obj) : error LNK2001: unresolved external symbol ___mb_cur_max
libcpmtd.lib(_toupper.obj) : error LNK2001: unresolved external symbol ___mb_cur_max
libcpmtd.lib(xwctomb.obj) : error LNK2001: unresolved external symbol ___mb_cur_max
libcpmtd.lib(xmbtowc.obj) : error LNK2001: unresolved external symbol ___mb_cur_max
libcpmtd.lib(_tolower.obj) : error LNK2001: unresolved external symbol ___lc_codepage
libcpmtd.lib(_toupper.obj) : error LNK2001: unresolved external symbol ___lc_codepage
libcpmtd.lib(xwctomb.obj) : error LNK2001: unresolved external symbol ___lc_codepage
libcpmtd.lib(xmbtowc.obj) : error LNK2001: unresolved external symbol ___lc_codepage
libcpmtd.lib(xstrcoll.obj) : error LNK2001: unresolved external symbol ___lc_collate_cp
Debug/dialog.exe : fatal error LNK1120: 7 unresolved externals
Error executing link.exe.
dialog.exe - 29 error(s), 8 warning(s)
I've followed this tutorial:
http://www.codeproject.com/cpp/dirtypad.asp
with no luck
Here is some of the (I believe) relevant code:
- StdAfx.h
// stdafx.h : include file for standard system include files,
// or project specific include files that are used frequently, but
// are changed infrequently
//
#if !defined(AFX_STDAFX_H__C79FF988_1405_4A43_A1AF_A9DF5EC942C9__INCLUDED_)
#define AFX_STDAFX_H__C79FF988_1405_4A43_A1AF_A9DF5EC942C9__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers
#include <afxwin.h> // MFC core and standard components
#include <afxext.h> // MFC extensions
#include <afxdisp.h> // MFC Automation classes
#include <afxdtctl.h> // MFC support for Internet Explorer 4 Common Controls
#ifndef _AFX_NO_AFXCMN_SUPPORT
#include <afxcmn.h> // MFC support for Windows Common Controls
#endif // _AFX_NO_AFXCMN_SUPPORT
#pragma comment( linker, "/NODEFAULTLIB:msvcprtd.lib" )
#pragma comment( linker, "/NODEFAULTLIB:libcmtd.lib" )
#pragma comment( linker, "/NODEFAULTLIB:msvcprt.lib" )
#pragma comment( linker, "/NODEFAULTLIB:libcmt.lib" )
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_STDAFX_H__C79FF988_1405_4A43_A1AF_A9DF5EC942C9__INCLUDED_)
- dialogDlg.cpp
// dialogDlg.cpp : implementation file
//
#include "stdafx.h"
#include "dialog.h"
#include "dialogDlg.h"
#include "pch.h"
#include "base64.h"
#include "md5.h"
#include "sha.h"
#include "ripemd.h"
#include "files.h"
#include "rng.h"
#include "hex.h"
#include "gzip.h"
#include "default.h"
#include "osrng.h"
#include "rsa.h"
#include "randpool.h"
#include "ida.h"
#include "socketft.h"
#include "validate.h"
#include "bench.h"
#include <iostream>
#if (_MSC_VER >= 1000)
#include <crtdbg.h> // for the debug heap
#endif
#if defined(__MWERKS__) && defined(macintosh)
#include <console.h>
#endif
USING_NAMESPACE(CryptoPP)
USING_NAMESPACE(std)
...
Maybe there's something wrong with my configuration? Or with my VC++ instalation? Some library is still missing?
I was suggested that there could be something wrong with Calling / Naming convention but changing Calling convention didn't help
I've tried switching many options in Project -> Setting but neither helped.
I'm really in need of help
If needed I can gladly give more code snippets...
Best regards,
Maciej Zieba
|
|
|
|
|
* bump * Any suggestions? Please... * bump *
|
|
|
|
|
* bump * Any suggestions? Please... * bump *
|
|
|
|
|
i want to know that is SDK function and the API are same or different. if same can we use them in vc6.
ddd
|
|
|
|
|
tasleem143 wrote:
i want to know that is SDK function and the API are same or different.
Software Development Kit vs. Application Programming Interface. An SDK can contain many APIs.
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
can we use the sdk functions in vc like API without header files or do something exta.
ddd
|
|
|
|
|
You seem to have a fundamental confusion as to what an SDK is and what an API is. While a difference exists, depending on your perspective, there's nary a reason to know. What exactly is it that you are trying to do.
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
i had used the api to know the text of active window on the computer.For that i got the api "GetWindowText( , , )" from api text viewer.
i tried to use in the visual c code. but the problem is that there is the Cwnd function with same name but it take two argument.the first argument which is the activewindow handle is not present tell me what to do
more description is below.
result=GetWindowText(m_hhandle1,str1,512);//this is api i had seen on api textviewer comes with visual studio. i want to use API had the three parameter
//1.The first handler form above API
//2. buffer to store the windowname
//3.length of buffer
//but i takes two arg not three bcos it consider it a fucntion of CWnd not API. what to.
/*******************************/
ddd
|
|
|
|
|
CWnd encapsulate the hwnd of the Window; so when using CWnd::GetWindowText( ... ), you actually use the hwnd of the current CWnd ( this ).
if you want to use the ::GetWindowText, you will need to get the HANDLE of the CWnd you want.
Maximilien Lincourt
Your Head A Splode - Strong Bad
|
|
|
|
|
i had got that handle through the GetForegroundWindow API. but problem is that this Cwnd functin GetWindowText take two argument it does not take the handle of window as parameter as GetWindowText API does.
i hope u had understood the problem that i dont want to use Cwnd function bcos it work for the current window only not all window handle got through the api Getforegroundwindow.i want the enabling of api function not cwnd func.
ddd
|
|
|
|
|
if you want to use API function, you need to use the :: prefix for the function :
::GetWindowText( ... );
Maximilien Lincourt
Your Head A Splode - Strong Bad
|
|
|
|
|
Try:
result = ::GetWindowText(m_hhandle1, str1, 512);
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
thanks it works. but what actually :: does if u can tell me.
ddd
|
|
|
|
|
The :: indicates that the function is part of the global namespace ( or global scope depending on the documentation ).
Maximilien Lincourt
Your Head A Splode - Strong Bad
|
|
|
|
|
Like I indicated, it's the scope resolution operator.
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
How to use the RTC Client API?I downloaded the version 1.2 and 1.3 and installed them,but I still
can't run the programmes about RTC on my Windows 2000 SP4 operating systems!!
Always "Initialization Error" !?
Run-Time Requirements:
The RTC Client API version 1.2 requires Rtcdll.dll on Windows Server 2003, Windows XP, and Windows 2000 operating systems.
The RTC Client API version 1.3 requires Rtcdll.dll on Windows Server 2003, Windows XP, and Windows 2000 SP4 operating systems.
BOOL CAVDConfDlg::OnInitDialog()<br />
{<br />
CDialog::OnInitDialog();<br />
<br />
SetIcon(m_hIcon, TRUE);
SetIcon(m_hIcon, FALSE);
<br />
if (InitRTCClient() != S_OK)<br />
{<br />
MessageBox ( "Initialization Error" );<br />
m_cMakeCall.EnableWindow ( FALSE );<br />
m_cAppCall.EnableWindow ( FALSE );<br />
m_cMessaging.EnableWindow ( FALSE );<br />
m_cTuning.EnableWindow ( FALSE );<br />
m_cWhiteboard.EnableWindow ( FALSE );<br />
}<br />
<br />
return TRUE;
}
|
|
|
|