|
sorry rod!
those articles were really helpful,
but still i think u were rude!
|
|
|
|
|
Good point, I must admit I forget about those as well.
Christian
No offense, but I don't really want to encourage the creation of another VB developer.
- Larry Antram 22 Oct 2002
C# will attract all comers, where VB is for IT Journalists and managers - Michael
P Butler 05-12-2002
Again, you can screw up a C/C++ program just as easily as a VB program. OK, maybe not
as easily, but it's certainly doable. - Jamie Nordmeyer - 15-Nov-2002
|
|
|
|
|
|
I want to get every HTML page when IE load it, any idea?
Thank you.
|
|
|
|
|
Either you can Embedd Web Browser component and load respective html page or
use following in a DialogBox for invoking Html page:
HWND h = FindWindowEx(NULL,NULL,NULL,"Microsoft Internet Explorer");
ShellExecute(h,"open","http:\\\\www.funducode.com",NULL,NULL,SW_SHOWNORMAL);
|
|
|
|
|
Hello Dear All,
I've been doing Windows NT 4.0 development since 1997 and I'm relatively new to Windows XP. I've recently heard that Named Pipes are no longer supported in Windows XP or that it will be gradually phased out in the long run.
I'm wondering if this is truly the case. I've referred to the MSDN documentation for Named Pipes and noted that it is supported in XP and there is no mention of it becoming obsolete.
I personally do not think Named Pipes will become obsolete anytime in the future but has anyone vaguely heard of this possibility ?
Thanks, All,
Bio.
|
|
|
|
|
Hi guys,
I've a dial up connection available on a pc to which I'm connected via LAN. I want to connect to internet using this dial up connection. How can I do that? Is it possible to invoke that dial up connection through my program also.
Thanks
Deepak
|
|
|
|
|
im looking for the fastest, easiest, (hopefully very W3C conformant) XML parsing/writing library -- preferably support for event-based parsing
i've tried microsoft's MSXML but it's unbelievably hard to use with all the COM interfaces and stuff it gets annoying
thanks for the help
- Roman -
|
|
|
|
|
one of the fastest is expat[^] (James Clark, W3C). And yes it's event based. It doesn't write Xml though.
(MSXML 4.0 is f***ing fast either, but the SDK has limitations, and it's of course full of proprietary interfaces and behaviours).
|
|
|
|
|
Does anyone know of universal naming convention (UNC) path?
thank you
|
|
|
|
|
UNC paths AFAIK, start with "\\", such as "\\server\share\". Take a look in the MSDN for further information.
Chris Richardson
Programmers find all sorts of ingenious ways to screw ourselves over. - Tim Smith
|
|
|
|
|
Is there any sample code using an ActiveX control (ie. MSFlexGrid) in a DLL Dialog that is loaded dynamically by the client.
|
|
|
|
|
I initially started this message thread as I had a problem getting the ado connection at startup....
i had written the exe path in a key in registry
"HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\\Run"...though the exe startsup an ado connection error is thrown if ado connection is tried in InitInstance of the app
ive finally got it right..consider the following code
-----------------------------------
CoInitializeEx(NULL, 0x02);
try{
_ConnectionPtr mpDBConnection;
mpDBConnection.CreateInstance(__uuidof(Connection));
HRESULT hRes=mpDBConnection->Open(_T("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=database\\TrialDB.mdb;Persist Security Info=False"),"","",adConnectUnspecified);
CStartUpDlg dlg;
m_pMainWnd = &dlg;
...
...
..
-----------------------------------
this works fine when normally executed and the database connection is ok.
however in startup when saying "database\TrialDB.mdb" instead of refering to the relative path of the application it assumes it as being in "c:\" drive.....
and therefore looks for the database in "c:\database\TrialDB.mdb" ..
and obviously as there is no database there the connection fails.
however if the code is changed tohaving the follwoing lines occure before the connection is opened like below
-----------------------------------
CoInitializeEx(NULL, 0x02);
try{
CStartUpDlg dlg;
m_pMainWnd = &dlg;
_ConnectionPtr mpDBConnection;
mpDBConnection.CreateInstance(__uuidof(Connection));
HRESULT hRes=mpDBConnection->Open(_T("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=database\\TrialDB.mdb;Persist Security Info=False"),"","",adConnectUnspecified);
...
...
..
-----------------------------------
the conection works fine in startup as well..
but unfortunately as i need to do the database connection before I create the dialog object..... the question persists...
1.Why cant i get the relative path in startup????
2.Please suggest an alternative solution to get the relative path....
i mean besides using get CurrentDirectory() and that kind of stuff
Consider for example when we create a shortcut
we can specify a 'start in' directory
and all relative paths refer to this strt in directory right??
is there anywhere i can specify such a 'start in' directory for an application in registry!!!
if there is any other method to get the relative path of the app please tell me...
|
|
|
|
|
If you want to get the path of the .exe at runtime, take a look here:
http://www.codeproject.com/cpp/cppforumfaq.asp#win_exepath[^]
You can strip off the exe name, and then you have the directory the program is running from.
Chris Richardson
Programmers find all sorts of ingenious ways to screw ourselves over. - Tim Smith
|
|
|
|
|
thankx but no thankx
cause one i already said i didnt need more apis like GetCurrentDirectory()
hells there s countless methods where i can get the app path and then go on for concatenating
and secondly and more importantly my primary question as to why the relative path isnt recoognised at startup remains unanswered.
i was thinking more in lines of as how the application framework finds its the current directory.....
if there must be some variable on m_pMainWnd or soemthing setting that would men lesser work and a more efficient solution than changing of code for the concatenation...
for example app has m_pszHelpFilePath to set the help file path
there must be something where the path is stored so that the exe can refer to it when a relative path is called
if im wrong pls correct me?
and pls tell me whythe relative path isnt recoognised at startup remains unanswered.
|
|
|
|
|
Well, no matter which route you go, you will almost undoubtably end up using GetModuleFileName (directly or indirectly). CWinApp is even using it to format the m_pszHelpFilePath (take a look in MFC sources).
Why isn't the relative path recognized at startup? Well, it is being recognized. It's just that it's being recognized as being relative to the "C:\" path, instead of the path your app resides in. Putting relative paths in your program and depending on Windows to set your directory for you is never a good idea, and the best way to not do it, is probably to use GetModuleFileName. It will be all of 6 lines of code, and you will remove the risk of not finding your database (unless the database gets deleted).
fordge wrote:
there must be something where the path is stored so that the exe can refer to it when a relative path is called
Refer to the documentation on CreateFile or the Open method of the database connection object for a list of paths that are searched when you use a relative path name.
Chris Richardson
Programmers find all sorts of ingenious ways to screw ourselves over. - Tim Smith
|
|
|
|
|
$(ProjDir) -> I use this to set things up in my project, don't know if it is valid while running...worth a try.
|
|
|
|
|
Why does the following code show the Same Dialog Box twice? The code for the Dialog boxes in inside a dll and the call to the CreateCharacter() is called from the main application. The problem is that the application only shows the first dialog box, even though the "Testing" message box does appear. This tells me that the application is call the correct class, but not showing the correct dialog box.
Thanks for any help you can give.
#include "StdAfx.h"<br />
#include "ExportedFunctionsCVNChar.h"<br />
#include "NewChar1.h"<br />
#include "NewChar2.h"<br />
<br />
DLLEXPORT BOOL CreateNewCharacter()<br />
{<br />
CNewChar1 dlg;<br />
CNewChar2 dlg2;<br />
int nResult;<br />
<br />
nResult = dlg.DoModal();<br />
<br />
if(nResult == IDOK)<br />
{<br />
nResult = dlg2.DoModal();<br />
}<br />
<br />
return TRUE;<br />
}<br />
class CNewChar1 : public CDialog<br />
{<br />
public:<br />
CNewChar1(CWnd* pParent = NULL);
BOOL OnInitDialog();<br />
<br />
enum { IDD = IDD_NEWCHAR1 };<br />
CComboBox m_cClass;<br />
CComboBox m_cRace;<br />
CString m_strAL;<br />
int m_nCha;<br />
CString m_strClass;<br />
int m_nCon;<br />
int m_nDex;<br />
int m_nHitPts;<br />
int m_nInt;<br />
CString m_strName;<br />
CString m_strRace;<br />
int m_nStr;<br />
int m_nWis;<br />
<br />
<br />
protected:<br />
virtual void DoDataExchange(CDataExchange* pDX);
<br />
protected:<br />
<br />
DECLARE_MESSAGE_MAP()<br />
};<br />
<br />
class CNewChar2 : public CDialog<br />
{<br />
public:<br />
CNewChar2(CWnd* pParent = NULL);
BOOL OnInitDialog();<br />
enum { IDD = IDD_NEWCHAR2 };<br />
CString m_strGender;<br />
CString m_strHand;<br />
CString m_strDeity;<br />
CString m_strEyeColor;<br />
CString m_strHairColor;<br />
CString m_strHeight;<br />
int m_nWeight;<br />
<br />
<br />
protected:<br />
virtual void DoDataExchange(CDataExchange* pDX);
<br />
protected:<br />
<br />
DECLARE_MESSAGE_MAP()<br />
};<br />
<br />
CNewChar1::CNewChar1(CWnd* pParent )<br />
: CDialog(CNewChar1::IDD, pParent)<br />
{<br />
m_strAL = _T("");<br />
m_nCha = 0;<br />
m_strClass = _T("");<br />
m_nCon = 0;<br />
m_nDex = 0;<br />
m_nHitPts = 0;<br />
m_nInt = 0;<br />
m_strName = _T("");<br />
m_strRace = _T("");<br />
m_nStr = 0;<br />
m_nWis = 0;<br />
}<br />
<br />
<br />
void CNewChar1::DoDataExchange(CDataExchange* pDX)<br />
{<br />
CDialog::DoDataExchange(pDX);<br />
DDX_Control(pDX, IDC_CLASS, m_cClass);<br />
DDX_Control(pDX, IDC_RACE, m_cRace);<br />
DDX_Text(pDX, IDC_AL, m_strAL);<br />
DDX_Text(pDX, IDC_CHA, m_nCha);<br />
DDV_MinMaxInt(pDX, m_nCha, 1, 99);<br />
DDX_CBString(pDX, IDC_CLASS, m_strClass);<br />
DDX_Text(pDX, IDC_CON, m_nCon);<br />
DDV_MinMaxInt(pDX, m_nCon, 1, 99);<br />
DDX_Text(pDX, IDC_DEX, m_nDex);<br />
DDV_MinMaxInt(pDX, m_nDex, 1, 99);<br />
DDX_Text(pDX, IDC_HITPTS, m_nHitPts);<br />
DDV_MinMaxInt(pDX, m_nHitPts, 1, 999);<br />
DDX_Text(pDX, IDC_INT, m_nInt);<br />
DDV_MinMaxInt(pDX, m_nInt, 1, 99);<br />
DDX_Text(pDX, IDC_NAME, m_strName);<br />
DDX_CBString(pDX, IDC_RACE, m_strRace);<br />
DDX_Text(pDX, IDC_STR, m_nStr);<br />
DDV_MinMaxInt(pDX, m_nStr, 1, 99);<br />
DDX_Text(pDX, IDC_WIS, m_nWis);<br />
DDV_MinMaxInt(pDX, m_nWis, 1, 99);<br />
}<br />
<br />
BOOL CNewChar1::OnInitDialog()<br />
{<br />
<br />
CDialog::OnInitDialog();
<br />
HINSTANCE hHandle;<br />
LPTSTR lpStringResource = NULL;<br />
CString strString;<br />
UINT uResourceId;<br />
int nResult;<br />
BOOL bDone = FALSE;<br />
<br />
hHandle = LoadLibrary(_T("CVPlayersHndBk.cvl"));<br />
if(hHandle == NULL)<br />
MessageBox(_T("Error loading CVPlayerHndBk.cvl!"), _T("Initialize Error"), MB_ICONEXCLAMATION);<br />
else<br />
{<br />
uResourceId = 1000;<br />
<br />
while(!bDone)<br />
{<br />
nResult = strString.LoadString(uResourceId);
<br />
if(nResult)<br />
{<br />
nResult = m_cRace.AddString(strString);<br />
if(nResult == CB_ERR)<br />
{<br />
MessageBox(_T("Error loading Races."), _T("CVNewCharacter Error"), MB_ICONEXCLAMATION);<br />
bDone = TRUE;<br />
}<br />
else<br />
{<br />
lpStringResource = NULL;<br />
uResourceId++;<br />
}<br />
}<br />
else<br />
{<br />
bDone = TRUE;<br />
}<br />
}<br />
<br />
uResourceId = 2000;<br />
bDone = FALSE;<br />
strString.Empty();<br />
<br />
while(!bDone)<br />
{<br />
nResult = strString.LoadString(uResourceId);
<br />
if(nResult)<br />
{<br />
nResult = m_cClass.AddString(strString);<br />
if(nResult == CB_ERR)<br />
{<br />
MessageBox(_T("Error loading Races."), _T("CVNewCharacter Error"), MB_ICONEXCLAMATION);<br />
bDone = TRUE;<br />
}<br />
else<br />
{<br />
lpStringResource = NULL;<br />
uResourceId++;<br />
}<br />
}<br />
else<br />
{<br />
bDone = TRUE;<br />
}<br />
}<br />
<br />
}<br />
<br />
FreeLibrary(hHandle);
<br />
return TRUE;<br />
}<br />
<br />
BEGIN_MESSAGE_MAP(CNewChar1, CDialog)<br />
END_MESSAGE_MAP()<br />
<br />
<br />
CNewChar2::CNewChar2(CWnd* pParent )<br />
: CDialog(CNewChar2::IDD, pParent)<br />
{<br />
m_strGender = _T("");<br />
m_strHand = _T("");<br />
m_strDeity = _T("");<br />
m_strEyeColor = _T("");<br />
m_strHairColor = _T("");<br />
m_strHeight = _T("");<br />
m_nWeight = 0;<br />
}<br />
<br />
<br />
void CNewChar2::DoDataExchange(CDataExchange* pDX)<br />
{<br />
CDialog::DoDataExchange(pDX);<br />
<br />
}<br />
<br />
BOOL CNewChar2::OnInitDialog()<br />
{<br />
CDialog::OnInitDialog();
<br />
MessageBox(_T("Testing"));<br />
<br />
return TRUE;<br />
}<br />
<br />
BEGIN_MESSAGE_MAP(CNewChar2, CDialog)<br />
END_MESSAGE_MAP()<br />
<br />
<br />
|
|
|
|
|
It's hard to read so much code, but at a guess, are the two ID's for the resources the same ?
Christian
No offense, but I don't really want to encourage the creation of another VB developer.
- Larry Antram 22 Oct 2002
C# will attract all comers, where VB is for IT Journalists and managers - Michael
P Butler 05-12-2002
Again, you can screw up a C/C++ program just as easily as a VB program. OK, maybe not
as easily, but it's certainly doable. - Jamie Nordmeyer - 15-Nov-2002
|
|
|
|
|
is there any chance IDD_NEWCHAR1 has the same value as IDD_NEWCHAR2 ?
-c
Zzzzz...
|
|
|
|
|
Sorry for so much code, but I couldn't figure out how to attach the files to my message. The two ids IDD_NEWCHAR1 and IDD_NEWCHAR2 are defined in resource.h as 129 and 130 respectively. If someone can point out how to attach the files I would be more than happy to attach the code to make it easier to read.
Thanks again for the help,
-Eric
|
|
|
|
|
Firstly, its not possible to attach a file to a message on the CP boards.
As a possible solution, how is the DLL that has these dialog loaded? Is it dynamic? If it is, you may have to use the AFX_MANAGE_STATE() macro or the AfxSetResourceHandle() command to make sure that the correct resources are used when the DoModal() call is performed. Check you application that uses the DLL and see whether it has matching dialog resources using the same resource ID values (i.e. 129/130 as mentioned in the other reply).
Roger Allen
Sonork 100.10016
This is a multiple choice question, choose wisely
Why did the hedgehog cross the road?
A: To show he had guts?
B: To see his flat mate?
|
|
|
|
|
Roger,
Thanks for the help. The problem was that in the dll I had the resource ID defined as 129 & 130 as I already indicated. In the main application I also had some resource IDs with the same values. I did not realize that the two applications had to have seperate resource IDs.
The dll is statically linked to the main application, is this what caused this problem? If I were to dynamically load the dll would I still run into the same issue?
Anyways, thanks for the help! I was able to move on in the project again which I was stuck on for over a week.
Thanks,
-Eric
|
|
|
|
|
When you link to an MFC extension DLL, its resources are listed in a resource chain that is searched when looking for one. If its not found in the apps resources, each MFC extension DLL is checked in the order added to the chain until a matching resource is found (if available). This is why you were getting the problem as an existing resource already existed in your app with the same ID.
Its just a matter of being cautious.
Anyway, glad it solved your problem.
Roger Allen
Sonork 100.10016
This is a multiple choice question, choose wisely
Why did the hedgehog cross the road?
A: To show he had guts?
B: To see his flat mate?
|
|
|
|
|
I would like to be able to select some text (Specifically the URL in the Opera web browser), press CTRL+SomeKey or right click and select a command which copies the selected text into my program, which then changes the text and pastes the new text into the same place.
Is this possible using a shell extension? Or is there another way to accomplish this?
Thanks for any suggestions that could point me in the right direction.
|
|
|
|
|