|
We used the Installshield that came with VC++6 to do the (fairly simple) installation of our VC6 apps, and this worked well for many years. One issue that encouraged us to change was that the setup.exe file that comes with this installshield, and that the user runs do the installation, is a 16-bit app. This can lead to the embarrassing situation that if the user's computer is not configured correctly for 16-bit apps (and many XP boxes are not - particularly after installing service packs) then the user cannot install your 32-bit app as the 16-bit installation program won't run!
There many reports of this on the web, e.g.
http://unodocs.nmsu.edu/RoboDocs/WebHelp/jinitiator/ji_05.htm[^]
Peter.
|
|
|
|
|
TssPrasad wrote: Is it possible to make use custom action dll & coinstaller in Installshield with VC++ 6.0??
IMHO, I never like Installer created by Install Shield ...as it too big.. i always prefer.. what Tox has suggested !
|
|
|
|
|
|
InstallShield is a horrible product, and there are several free alternatives like NSIS and Inno Setup.
|
|
|
|
|
Hi all,
The other day I got a code snippet of MSDN, I know what it does and what it's used for.
But what I don't understand is, when I type my ip address in,
it states that I'm not connected and when I type in any ip the code states that I'm Connected.
struct in_addr BIN_IPV4_ADDR_LOOPBACK = {127, 0, 0, 1};
struct in6_addr BIN_IPV6_ADDR_LOOPBACK = { 0x0, 0x0,
0x0, 0x0,
0x0, 0x0,
0x0, 0x0,
0x0, 0x0,
0x0, 0x0,
0x0, 0x0,
0x0, 0x1 };
#define MAX_LOCAL_NAME_LEN 64
BOOL IsNetPresent();
void Print(TCHAR *pFormat, ...);
int _tmain (int argc, TCHAR* argv[])
{
WSADATA WSAData;
WSAStartup(MAKEWORD(2,2), &WSAData);
if (IsNetPresent())
Print(TEXT("Network Connection IS present"));
else
Print(TEXT("Network Connection is NOT present"));
WSACleanup();
getch();
return 0;
}
BOOL IsNetPresent()
{
BOOL bFoundLocalAddr = FALSE;
char szAddrASCII[MAX_LOCAL_NAME_LEN];
ADDRINFO AddrHints, *pAI, *pAddrInfo;
if(gethostname(szAddrASCII, MAX_LOCAL_NAME_LEN - 1))
{
Print(TEXT("Error getting local host name, error = %d"), WSAGetLastError());
return FALSE;
}
memset(&AddrHints, 0, sizeof(AddrHints));
AddrHints.ai_family = PF_UNSPEC;
AddrHints.ai_flags = AI_PASSIVE;
if(getaddrinfo(szAddrASCII, "10", &AddrHints, &pAddrInfo))
{
Print(TEXT("getaddrinfo(%hs) error %d"), szAddrASCII, WSAGetLastError());
return FALSE;
}
bFoundLocalAddr = TRUE;
for(pAI = pAddrInfo; pAI != NULL && bFoundLocalAddr; pAI = pAI->ai_next)
{
if(pAI->ai_family == PF_INET)
{
if(memcmp(&(((SOCKADDR_IN *)(pAI->ai_addr))->sin_addr), &BIN_IPV4_ADDR_LOOPBACK, sizeof(BIN_IPV4_ADDR_LOOPBACK)) == 0)
bFoundLocalAddr = FALSE;
}
else if(pAI->ai_family == PF_INET6)
{
if(memcmp(&(((SOCKADDR_IN6 *)(pAI->ai_addr))->sin6_addr), &BIN_IPV6_ADDR_LOOPBACK, sizeof(BIN_IPV6_ADDR_LOOPBACK)) == 0)
bFoundLocalAddr = FALSE;
}
}
freeaddrinfo(pAddrInfo);
return bFoundLocalAddr;
}
void
Print(
TCHAR *pFormat,
...)
{
va_list ArgList;
TCHAR Buffer[256];
va_start (ArgList, pFormat);
(void)StringCchPrintf(Buffer, 256, pFormat, ArgList);
#ifndef UNDER_CE
_putts(Buffer);
#else
OutputDebugString(Buffer);
#endif
va_end(ArgList);
}
Could anyone please give me some help, clearly I don't understand it correctly.
Many Thanks
Regards,
The only programmers that are better than C programmers are those who code in 1's and 0's.....
Programm3r My Blog: ^_^
|
|
|
|
|
Probably, code is working correct but some logic inside is messed,
Programm3r wrote: if(pAI->ai_family == PF_INET) { if(memcmp(&(((SOCKADDR_IN *)(pAI->ai_addr))->sin_addr), &BIN_IPV4_ADDR_LOOPBACK, sizeof(BIN_IPV4_ADDR_LOOPBACK)) == 0) bFoundLocalAddr = FALSE; }
Here, comparison betn host's ip address and BIN_IPV4_ADDR_LOOPBACK will return value 0 . And in that case bFoundLocalAddr is assigned value FALSE .
So, its is returning wrong value.
So you are returning wrong value from IsNetPresent .
|
|
|
|
|
So when you stepped through the code using your debugger, what did you find out?
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Programm3r wrote: when I type my ip address in
When you type it in where?
Mark
"Great job, team. Head back to base for debriefing and cocktails."
(Spottswoode "Team America")
|
|
|
|
|
If I have a populated dataGrid in visual c++, how can I get values from the dataGrid without going to the underlying dataSet.
Is there a way to use dataGrid->currentRowIndex to reference the row and then return the value from a given column.
Thanks!!
Kim
|
|
|
|
|
webHamlet wrote: d dataGrid in visual c++,
Which dataGrid!
|
|
|
|
|
I'm just using the standard one from system::data in visual studio.
thx.
Kim
|
|
|
|
|
I created a tabbed dialog (with 2 tabs) without property sheets. I created a menu on the main dialog that I want to associate with one of the tabs of the tabbed dialog. I want to convert temperature on the embedded dialog to a celsius value when selecting the option from the menu.
I have an error when using the SendMessage function. The commented statements are different ways I have attempted to send a message but they are incorrect. A pointer references each embedded dialog.
Following this function are excerpts from my code (main dialog file, embedded dialog file).
Does anyone have any suggestions?
void CMotionAnalyzerDlg::OnTemperatureCelsius()
{
/* linking error ASSERT(::IsWindow(m_hWnd) || (m_pCtrlSite != NULL));*/
//m_dPointer[0]->SendMessage(WM_MENU_CELSIUS,0,0);
/* errorC2664: caanot convert parameter 1 from _3DSEmbeddedDialog* to UINT */
//SendMessage(m_dPointer[0], WM_MENU_CELSIUS);
/* errorC2664: caanot convert parameter 1 from HWND to UINT */
//SendMessage(m_dPointer[0]->m_hWnd, WM_MENU_CELSIUS);
}
---------------------------------------------------------------------------------------
//MAIN DIALOG HEADER FILE
class CMotionAnalyzerDlg : public CDialog
{
public:
...
MoteDataDlg moteDataDlg; //mote data dialog object (embedded)
DatabaseDlg databaseDlg; //database dialog object (embedded)
void ShowEmbeddedDialog(int number); //shows the proper embedded dialog
CTabCtrl dialogTabCtrl; //Create instance of the child window class;
tab control for embedded dialogs
...
protected:
// Generated message map functions
...
afx_msg void OnTemperatureCelsius();
DECLARE_MESSAGE_MAP()
private:
CRect embeddedDialogRect; //structure to hold the position of child windows
_3DSEmbeddedDialog *m_dPointer[2]; //Create and assign pointers to each window
...
};
-----------------------------------------------------------------------------------------
//MAIN DIALOG .CPP FILE
BEGIN_MESSAGE_MAP(CMotionAnalyzerDlg, CDialog)
...
ON_COMMAND(ID_TEMPERATURE_CELSIUS, OnTemperatureCelsius)
END_MESSAGE_MAP()
BOOL CMotionAnalyzerDlg::OnInitDialog()
{
...
//Create all embedded dialogs for the main window class
moteDataDlg.Create(IDD_MOTE_DATA_DIALOG, this);
databaseDlg.Create(IDD_DATABASE_DIALOG, this);
...
}
//Shows the proper embedded dialog
void CMotionAnalyzerDlg::ShowEmbeddedDialog(int number)
{
int windowCount = 2; //Uses two windows
if ((number >= 0) && (number < windowCount))
{
m_dPointer[0] = &moteDataDlg;
m_dPointer[1] = &databaseDlg;
// Hide every window except for the chosen one
for (int count = 0; count < windowCount; count++)
{
if (count != number)
m_dPointer[count]->HideEmbedded(); //Hide the embedded dialog
else if (count == number)
{
// Show the chosen window and set it's location
m_dPointer[count]->SetWindowPos(&wndTop, embeddedDialogRect.left,
embeddedDialogRect.top, embeddedDialogRect.right,
embeddedDialogRect.bottom, SWP_SHOWWINDOW);
dialogTabCtrl.SetCurSel(count); // Update selection tab
m_dPointer[count]->ShowEmbedded(); // Show the embedded dialog
}
}
void CMotionAnalyzerDlg::OnTemperatureCelsius()
{
//m_dPointer[0]->SendMessage(WM_MENU_CELSIUS,0,0);
//SendMessage(m_dPointer[0], WM_MENU_CELSIUS);
//SendMessage(m_dPointer[0]->m_hWnd, WM_MENU_CELSIUS);
}
-----------------------------------------------------------------------------------------
//3DSEMBEDDEDDIALOG FILE
3DSEmbeddedDialog::_3DSEmbeddedDialog(UINT nIDTemplate, CWnd* pParent)
: CDialog(nIDTemplate, pParent)
{
display = false;
}
void _3DSEmbeddedDialog::ShowEmbedded()
{
if(!display)
{
ShowWindow(SW_SHOW);
OnEmbeddedDisplay(display = true);
}
}
void _3DSEmbeddedDialog::HideEmbedded()
{
if(display)
{
ShowWindow(SW_HIDE);
OnEmbeddedDisplay(display = false);
}
}
-------------------------------------------------------------------------------------
//MOTEDATADLG (EMBEDDED DIALOG) HEADER FILE
#define WM_MENU_CELSIUS WM_APP + 100
class MoteDataDlg : public _3DSEmbeddedDialog //public CDialog
{
...
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
LRESULT WindowProc(UINT message, WPARAM wParam, LPARAM lParam);
...
}
---------------------------------------------------------------------------------
//MOTEDATADLG (EMBEDDED DIALOG) .CPP FILE
LRESULT MoteDataDlg::WindowProc(UINT message, WPARAM wParam, LPARAM lParam)
{
if (message==WM_MENU_CELSIUS)
{
celsiusFlag = !celsiusFlag;
AfxBeginThread(MyThreadProc, this);
}
return 0;
}
Trevy
|
|
|
|
|
Trevy wrote: /* linking error ASSERT(::IsWindow(m_hWnd) || (m_pCtrlSite != NULL));*/
//m_dPointer[0]->SendMessage(WM_MENU_CELSIUS,0,0);
This means that tabbed window you are talking about, is not considered as window, thats why ASSERT .
Trevy wrote: /* errorC2664: caanot convert parameter 1 from HWND to UINT */
//SendMessage(m_dPointer[0]->m_hWnd, WM_MENU_CELSIUS);
You need to modify this to,
::SendMessage(m_dPointer[0]->m_hWnd, WM_MENU_CELSIUS,0,0);
But, again it should be valid window..
p.s. Its better to divide problem in small sub problem. Nobody like to read such huge code, like me( posted without using <pre> tags).
|
|
|
|
|
How to disable a button which have a icon on it.
When i disable button the icon is disappered.
|
|
|
|
|
janpoo wrote: How to disable a button which have a icon on it.
You need to use EnaleWindow(FALSE) . Its has nothing do with icon on it.
janpoo wrote: When i disable button the icon is disappered.
Can you show code ? After disabling button, icon should gray out.
|
|
|
|
|
Am use this for load icon on button:
m_MyCon.SetIcon(IDI_MYCON_NO);
Disable that with :
m_MyCon.EnableWindow(FALSE);
|
|
|
|
|
janpoo wrote: IDI_MYCON_NO
I guess, IDI_MYCON_NO of type HICON and initialize with call to LoadIcon .
janpoo wrote: Disable that with :
m_MyCon.EnableWindow(FALSE);
Code seems perfectly fine to me. Icon on button will gray out, after disabling it. Are you considering it as disappearing ?
Otherwise, its difficult to guess what happening at your end from this information.
|
|
|
|
|
|
What is IDI_MYCON_NO ? Is it handle?
|
|
|
|
|
I loaded bitmap on button.but it doesnt show like a normal button.It look like just image.i cant recognize the click.
so that am go with icon.I have load icon on button.It look like normal button.but when i disable the button ,icon disappeared.
which way is better for this.plz help me.
|
|
|
|
|
When You disable a button Icon and bitmap are same you see a gray image but can you explain about this button what does accomplish this button ?
|
|
|
|
|
janpoo wrote: When i disable button the icon is disappered.
have a look at CBitmapButton in MSDN!
|
|
|
|
|
Hi
In my application I want to start the application by dragging an associated data file and dropping onto the application or by file association. I retrieve the file name from the m_lpCmdLine variable which contains the file name with the complete path. I set a CString variable "strCWD" to equal the m_lpCmdLine but the File.Open command bombs to my error capture routine for "Nonexistant file". However, when I manually set strCWD to the same path and file contained in m_lpCmdLine, it opens correctly with the drag/drop routine. Does anyone know what is up with this?
Getting desperate...
code snippit (Sidebar: Can someone instruct me as to how to keep the code snippit format, i.e., tabs and spacings? Mine seem to be totally removed no matter how I format it.
// The main window has been initialized, so show and update it.
int nCmdShow = m_nCmdShow;
((CMainFrame*)m_pMainWnd)->InitialShowWindow(nCmdShow);
// Parse command line for standard shell commands, DDE, file open
// CCommandLineInfo cmdInfo;
// ParseCommandLine(cmdInfo);
// Dispatch commands specified on the command line
// if (!ProcessShellCommand(cmdInfo))
// return FALSE;
CFile File;
if (m_lpCmdLine[0] != '\0')
{
// drag & drop file to open
OnFileNew();
}
else
{
// create a new (empty) document
OnFileNew();
}
return TRUE;
}
void CFESIZER32App::OnFileNew()
{
UINT nStrLen = 0;
UINT nStrCount = 0;
char lpszCmdStr[_MAX_PATH];
CString strFilename;
CFile File;
CError Error;
if (m_lpCmdLine[0] != '\0')
{
strcpy(lpszCmdStr, m_pszHelpFilePath);
nStrLen = strlen(lpszCmdStr);
while (lpszCmdStr[nStrLen] != '\\')
{
lpszCmdStr[nStrLen] = 0;
--nStrLen;
}
g_strProgramPath = lpszCmdStr;
SetCurrentDirectory(lpszCmdStr);
strFilename = m_lpCmdLine;
// strFilename = "C:\\Documents and Settings\\My Documents\\My Application Data\\My File.fil";
}
else
{
strcpy(lpszCmdStr, m_pszHelpFilePath);
nStrLen = strlen(lpszCmdStr);
while (lpszCmdStr[nStrLen] != '\\')
{
lpszCmdStr[nStrLen] = 0;
--nStrLen;
}
g_strProgramPath = lpszCmdStr;
strFilename = g_strProgramPath + "Project" + ".fil";
}
// file exists -> open it
MessageBox(0, strFilename, "Debug Message #1", MB_OK);
if (File.Open(strFilename, CFile::modeRead))
{
File.Close();
theApp.OpenDocumentFile(strFilename);
}
// file does not exist -> create it
else if (File.Open(strFilename, CFile::modeCreate | CFile::modeWrite))
{
File.Write(&Project, sizeof(class CProjectData));
File.Close();
strFilename = g_strProgramPath + "\\Project" + ".idx";
if (File.Open(strFilename, CFile::modeCreate | CFile::modeWrite))
{
File.Close();
strFilename = g_strProgramPath + "\\Project" + ".fdb";
if (File.Open(strFilename, CFile::modeCreate | CFile::modeWrite))
{
File.Close();
}
theApp.OpenDocumentFile(strFilename);
}
}
}
|
|
|
|
|
Jim_Csoft wrote: strFilename = g_strProgramPath + "Project" + ".fil";
Does this causing the creation of invalid path ? I mean to say does g_strProgramPath is ended with "\\" , as your code is appending file name in front of that.
|
|
|
|
|
Prasad
You're looking at the standard open with application opening file. Back up to the drag and drop opening. The section labled as...
// FILE ASSOCIATION OR DRAG & DROP OPEN APPLICATION STARTUP
is the code section that executes on file association or drag & drop. I compile using the m_lpCmdLine setting the path, the program displays the proper path, but refuses to open, i.e., possible invalid path. However, using the // MANUAL STRING setting strCWD to the exact path, program works! Go figure. Does m_lpCmdLine require using the ParseCommandLine(cmdinfo) to extract the file path properly? Why doesn't the string contained in m_lpCmdLine represent a valid file path usable by the CFile File.Open(strCWD) command?
Thanks for responding!
|
|
|
|
|