|
thanks for your answers.
What I meant is:If there is a simple way like in Visual Basic where you right click at the properties of the button and you can change the back color the color you want.
Is there some thing like this in visual studio C++?
thanks again
|
|
|
|
|
|
There is nothing like what want in VC++,we have to write it
from Scratch.
Fly Like An Eagle With MIGHTY POWER.
|
|
|
|
|
Not in the dialog designer, but you can handle the WM_CTLCOLOR message and set the background colour there.
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
|
Hello everyone.
I have a simple question.
How can I give the buttons or forms a color
like in visual basic ?
Thanks in advance !
-- modified at 12:38 Monday 10th April, 2006
|
|
|
|
|
you maight find what you want here[^]...
|
|
|
|
|
Hi hektor kashuri,
I suggestion that you derived CButton and use WM_DRAWITEM
|
|
|
|
|
As others have pointed out, there's no VB-like "background color" property you can set. Instead, you'll need to paint the button yourself. See this[^] article.
/ravi
My new year's resolution: 2048 x 1536
Home | Music | Articles | Freeware | Trips
ravib(at)ravib(dot)com
|
|
|
|
|
hi there,
i need to send the decimal number "2" as a parameter to a function, but the method passes this parameter as a (u_char *). how can i stop this number from being converted to its ascii value of 50 when passing it through the parameter.
i can't send the ascii value of "2", as this is defined as STX in ascii table.
ian dineen
|
|
|
|
|
"2" is not a number but a C-Style null terminated string (actually, an array of two chars : { '2', '\0' } .
idineen wrote: how can i stop this number from being converted to its ascii value of 50 when passing it through the parameter.
can you show us a piece of the code by which you call the function, and how the function uses this parameter too ??
i'm quite sure you don't use it properly.
|
|
|
|
|
the code below is used to put a snmp object id into a pdu packet along with 3 parameters. the third parameter is used by the program to identify that the paramter is interrupted as a integer. the 4th parameter "test" is the number that i want to pass, this parameter is of type "(u_char *)" and the last is the length of the string.
snmp_pdu_add_variable(pdu, oid, oid_length, ASN_INTEGER , test, strlen(test));//
thanks
ian
|
|
|
|
|
Hi Idineen:
Do you have access to the source code of snmp_pdu_add_variable?
It could be that all variables are passed in as u_char*, then because of ASN_INTEGER, that function has code to convert it to an integer from the string value in test.
|
|
|
|
|
Try this:
int test = 2;
snmp_pdu_add_variable(pdu, oid, oid_length, ASN_INTEGER, reinterpret_cast<u_char*>(&test), sizeof(test));
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
|
> Should i set async read/close on the newly created socket?
The newly created socket will inherit the event mask from the server socket. It depends on the implementation of the async socket class that you use, set the events you are interested in the server socket instance and from there you create more sockets in your 'accept' handler (which will then use the same event mask).
Do not try to read data in the 'accept' handler. Have a 'read' handler which will tell you when there is (more) data available.
-- modified at 13:11 Wednesday 19th April, 2006
|
|
|
|
|
hello,
i have iexp6.0 with xp professionnel.
my code => chCtrlFrameBrowser:WebBrowser:Navigate(pcFileName,"",{&WINDOW-NAME},"","").
My problem is when i want to open a file (*.*) in a browser, it opens outside my browser and insidne my browser, it indicates a error message :
================================================================================================
Action annulée
Internet Explorer ne peut pas ouvrir la page Web requise. La page n'est peut-être pas disponible temporairement.
--------------------------------------------------------------------------------
Essayez de la manière suivante :
Cliquez sur le bouton Actualiser ou réessayez ultérieurement.
Si vous avez déjà visité cette page et souhaitez voir ce qui a été stocké sur votre ordinateur, cliquez sur Fichier, puis sur Travailler hors connexion.
Pour obtenir des informations sur la navigation hors connexion avec Internet Explorer, cliquez sur le menu ?, puis sur Sommaire et index.
Internet Explorer
=================================================================================================
Do you have any solutions.
Thanks.
MK.
|
|
|
|
|
i think you should translate what your browser tells you, because most people here speak english only...
here is the translation :
Action Canceled
Internet Explorer cannot open the requiered web page. The page may be temporarily unavailable.
------------------------------------------------------
Try the following mean :
Click the Refresh button or retry later.
If you already visited this page and wished to see what has been saved on your computer,
click on File, then Work offline.
For further informations about offline navigation with Internet Explorer, click on the ? menu, then on Contents and Index.
|
|
|
|
|
i am using InstallShield for VC++6 to create automated setup
of my project . So far i am able to create the setup.
but i have special need to create around six folders
in the default C: drive.these folders in C: drive will contains main data which my project needs.How can i do this with InstallShield for VC++6?
Fly Like An Eagle With MIGHTY POWER.
|
|
|
|
|
I have two edit controls named "name" and "location". when i enter a text in "name" edit control it shud be appended to "location" edit control.
Ex..
name : Hello
Location : c:\Desktop Search\Hello
here when the text "hello" is entered in "name" edit control,it shud be simultaneously appended with "location" edit control as shown in the example. pls help.
thanks
|
|
|
|
|
Hi sudeep_br
Name.GetWindowText(for read from Name)
Location.SetWindowText(write to Lication)
// like this
CEdit m_Edit1,m_Edit2;
CString Str,str="c:\\Desktop Search\\";
m_Edit1.GetWindowText(Str);
str.Insert(str.GetLength(),Str);
m_Edit2.SetWindowText(str);
|
|
|
|
|
i have two edit controls named "name" and "location". i also have a button called "folder select" using which users can select folders from different drives and assign it to location edit box. Theres also a "OK" button
The followind is the code i have put along with the code u provided:-
#include "stdafx.h"
#include "DesktopSearch.h"
#include "CreateDlg.h"
#include "UpdateDlg.h"
#include "FoldersDialog.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CCreateDlg dialog
CCreateDlg::CCreateDlg(CWnd* pParent /*=NULL*/)
: CDialog(CCreateDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CCreateDlg)
m_summary = -1;
//}}AFX_DATA_INIT
}
void CCreateDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CCreateDlg)
DDX_Control(pDX, IDC_FolderSelect, m_FolderSelect);
DDX_Control(pDX, IDC_Enter_Location, m_Enter_Location);
DDX_Control(pDX, IDC_Enter_Name, m_name);
DDX_Control(pDX, IDC_OK, m_ok);
DDX_Radio(pDX, IDC_Summary_only, m_summary);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CCreateDlg, CDialog)
//{{AFX_MSG_MAP(CCreateDlg)
ON_BN_CLICKED(IDC_FolderSelect, OnFolderSelect)
ON_BN_CLICKED(IDC_OK, OnOk)
ON_BN_CLICKED(IDC_Cancel, OnCancel)
ON_EN_CHANGE(IDC_Enter_Name, OnChangeEnterName)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CCreateDlg message handlers
extern TCHAR szDir[MAX_PATH];
void CCreateDlg::OnFolderSelect()
{
// TODO: Add your control notification handler code here
UpdateData(TRUE);
HWND hWnd = GetSafeHwnd();
CFoldersDialog objFD;
objFD.BrowseFolder(hWnd,m_Enter_Location);
m_Enter_Location = szDir;
UpdateData(FALSE);
}
void CCreateDlg::OnOk()
{
// TODO: Add your control notification handler code here
int iResults; // This variable will capture the button selection
// Ask the user
iResults = MessageBox("Would u like to add documetns to the index now",
"Desktop Search",MB_YESNO | MB_ICONQUESTION);
// Determine which button the user clicked
// Give the user a message showing which button was clicked
switch (iResults)
{
case IDYES: // The Yes button?
//call the Update dialog window if user press yes
m_dUpdateDlg.DoModal ();
break;
case IDNO: // The No button?
OnOK();
break;
}
}
void CCreateDlg::OnCancel()
{
code here
OnOK();
}
BOOL CCreateDlg::OnInitDialog()
{
CDialog::OnInitDialog();
UpdateData(FALSE);
CButton *pButton = (CButton*)this->GetDlgItem(IDC_OK);
pButton->EnableWindow(FALSE);
GotoDlgCtrl(GetDlgItem(IDC_OK));
return TRUE;
}
void CCreateDlg::OnChangeEnterName()
{
CButton *pButton = (CButton*)this->GetDlgItem(IDC_OK);
pButton->EnableWindow(TRUE);
CString Str,str="C:\\DesktopSearch\\Index\\";
m_name.GetWindowText(Str);
str.Insert(str.GetLength(),Str);
m_Enter_Location.SetWindowText(str);
}
The above code is giving 2 errors. both the edit control's variable typee is Cedit.
"error C2664: 'BrowseFolder' : cannot convert parameter 2 from 'class CEdit' to 'class CString'" and
"error C2582: 'CEdit' : 'operator =' function is unavailable"
pls help
Thanks
|
|
|
|
|
Hi sudeep_br,
This is a sample,I hope that help you
CEdit m_Edit1,m_Edit2;
CString m_Test1;
CString m_Test2;
m_Edit1.Create(WS_CHILD|WS_VISIBLE,CRect(0,0,100,23),this,1);
m_Edit2.Create(WS_CHILD|WS_VISIBLE,CRect(0,50,100,23),this,1);
m_Test1="C:\\DesktopSearch\\Index\\";
m_Edit1.SetWindowText(m_Test1);//Now set this string to edit1
////////Now/////////
m_Edit1.GetWindowText(m_Test2);//Read from edit1 into m_Test2 that is CString
m_Edit2.SetWindowText(m_Test2);//Now set m_Test2 to m_Edit2
//if you test this code it's fine no problem in your code
1-objFD.BrowseFolder(hWnd,m_Enter_Location);
you assain class CEdit to this function,But this function need to CString yes?
unless m_Enter_Location is CEdit well you need to get string from this Control then assain
value to function BrowseFolder.
2-I think that problem is m_Enter_Location = szDir;
m_Enter_Location is variable control(CEdit) but szDir is TCHAR
you need to m_Enter_Location.SetWindowText(szDir);
Right?
|
|
|
|
|
this is the code i put based on ur suggestion
#include "stdafx.h"
#include "DesktopSearch.h"
#include "CreateDlg.h"
#include "UpdateDlg.h"
#include "FoldersDialog.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CCreateDlg dialog
CCreateDlg::CCreateDlg(CWnd* pParent /*=NULL*/)
: CDialog(CCreateDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CCreateDlg)
m_summary = -1;
//}}AFX_DATA_INIT
}
void CCreateDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CCreateDlg)
DDX_Control(pDX, IDC_FolderSelect, m_FolderSelect);
DDX_Control(pDX, IDC_Enter_Location, m_Enter_Location);
DDX_Control(pDX, IDC_Enter_Name, m_name);
DDX_Control(pDX, IDC_OK, m_ok);
DDX_Radio(pDX, IDC_Summary_only, m_summary);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CCreateDlg, CDialog)
//{{AFX_MSG_MAP(CCreateDlg)
ON_BN_CLICKED(IDC_FolderSelect, OnFolderSelect)
ON_BN_CLICKED(IDC_OK, OnOk)
ON_BN_CLICKED(IDC_Cancel, OnCancel)
ON_EN_CHANGE(IDC_Enter_Name, OnChangeEnterName)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CCreateDlg message handlers
extern TCHAR szDir[MAX_PATH];
void CCreateDlg::OnFolderSelect()
{
// TODO: Add your control notification handler code here
UpdateData(TRUE);
HWND hWnd = GetSafeHwnd();
CFoldersDialog objFD;
CString s1;
m_Enter_Location.GetWindowText(s1);
objFD.BrowseFolder(hWnd,s1);
m_Enter_Location.SetWindowText(szDir);
UpdateData(FALSE);
}
void CCreateDlg::OnOk()
{
// TODO: Add your control notification handler code here
int iResults; // This variable will capture the button selection
// Ask the user
iResults = MessageBox("Would u like to add documetns to the index now",
"Desktop Search",MB_YESNO | MB_ICONQUESTION);
// Determine which button the user clicked
// Give the user a message showing which button was clicked
switch (iResults)
{
case IDYES: // The Yes button?
//call the Update dialog window if user press yes
m_dUpdateDlg.DoModal ();
break;
case IDNO: // The No button?
OnOK();
break;
}
}
void CCreateDlg::OnCancel()
{
// TODO: Add your control notification handler code here
OnOK();
}
BOOL CCreateDlg::OnInitDialog()
{
CDialog::OnInitDialog();
// TODO: Add extra initialization here
// m_Enter_Location = "C:\\DesktopSearch\\Index\\";
UpdateData(FALSE);
CButton *pButton = (CButton*)this->GetDlgItem(IDC_OK);
pButton->EnableWindow(FALSE);
GotoDlgCtrl(GetDlgItem(IDC_OK));
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
void CCreateDlg::OnChangeEnterName()
{
CButton *pButton = (CButton*)this->GetDlgItem(IDC_OK);
pButton->EnableWindow(TRUE);
CString m_Test1;
CString m_Test2;
//ERROR!!! IT SAYS CREATE CANNOT HAVE 4 PARAMETERS
m_ok.Create(WS_CHILD|WS_VISIBLE,CRect(0,0,100,23),this,1);
m_Enter_Location.Create(WS_CHILD|WS_VISIBLE,CRect(0,50,100,23),this,1);
m_Test1="C:\\DesktopSearch\\Index\\";
m_ok.SetWindowText(m_Test1);
m_ok.GetWindowText(m_Test2);
m_Enter_Location.SetWindowText(m_Test2);
}
for create it says create function cant have 4 parameters.
and to solve browsefolder problem i assigned a cstring object and passed it to browsefolder function(pls check the code)
during compilation it works fine. when i run it says "DEBUG ASSERTION FAILED"
what is wrong with my logic.pls check the code and let me know.
Thank you
|
|
|
|
|
yes because you need to caption or NULL
m_ok.Create(WS_CHILD|WS_VISIBLE,CRect(0,0,100,23),this,1);
to
m_ok.Create(NULL or "text",WS_CHILD|WS_VISIBLE,CRect(0,0,100,23),this,1);
|
|
|
|
|