|
Just wanted to give everyone a blanket THANKS. I finally am getting a good grasp of everything that is being said about pointers. I thought I had a good grasp before, but that creating a structure and then deleting it in another function kind of killed me
But thanks to all for being patient and taking the time to help me understand this one concept better.
Sam C
----
Systems Manager
Hospitality Marketing Associates
|
|
|
|
|
I created by Wizard ATL COM DLL that import my MFC extention DLL(from type: base Dialog) in my ATL.
Please check my steps (describes below) and tell me if I miss something.
(because when I try to perform its function from client program it become crazy)
------------------------------------------------------------------------
1. I opened project: ATL COM Wizard. [DLL] [MFC Support]
2. I inserted to the library that created the file : MyMfcDll.dll
and attached to the ATL project the files : MyMfcDll.h , MyMfcDll.lib
3. I Added by wizard ATL class [MyClass] [single] [dual]
4. I added by wizard method [ShowMfcDialog] to IMyClass and fill it so :
___________________________________________
#include "MyMfcDll.h"
STDMETHODIMP CMyClass::ShowMfcDialog()
{
AFX_MANAGE_STATE(AfxGetStaticModuleState())
CMyDialog dlg; //from the imported dll
dlg.DoModal();
return S_OK;
}
______________________________________________
5. I registered the dll (regsvr32)
and that's all !
What is missing ?
I will be greatful if you will help me ! PLEASE !!!!!
|
|
|
|
|
I'm trying to find a good article on how to use the CArray. I have never used CArray and would like to learn about it and implement it. Any one have a link to a good "How to" use CArrays?
Thanks,
Rob
|
|
|
|
|
Rob, CArray is like CList, but the principal diferens is that In CArray you Use Index and not Position like in CList, For me is more easy work with CArray.
If you need help, I'm here
Cheers;)
Carlos Antollini.
|
|
|
|
|
Thanks Carlos!
I have a app that uses a List control.. I get and send WM_COPYDATA messages to and from other apps. At that point I validate if that item is or is not all ready in the list control if it is I don't add it and if it's not I add it.. I then can minimize, maximize, close or do a ton of other functions using the list control..
After implementing all these different functions in the list I am starting to find that everything is getting super complicated in keeping track of whats in the list, what should be added or removed and what fields to change if something needs to be changed or updated..(I need to do validation on every cell and update needed cells with-out adding another entry) I have other people suggesting that I should use an array to keep track of everything and use the list to just view the data..
I have never used the CArray and don't even know if it's what I should use in my situation.. Any suggestions?
Rob
|
|
|
|
|
I agree with You.
I will give you a simple help.
For example:
The constructor of CArray is:
CArray<TYPE, TYPE>
Never forgot #include <afxtempl.h>
You can define
CArray<int,int> ptArray;
Or
CArray<MyClass, MyClass> ptArray;
ptArray.Add(20); //Add 20 as element 0
ptArray.Add(15); //Add 15 as element 1 in the array
ptArray.InsertAt(0, 23)); // New element 0
int num = ptArray.GetAt(1); //returns the element 1
int nSize = trArray.GetSize(); //returns the number of elements in the array.
you can append a array to another array
for example.
CArray<int, int> oArray;
oArray.Append(ptArray);
with removeAll you can delete all elements in the array.
ptArray.RemoveAll();
with RemoveAt() you can remove n elements in the array.
RemoveAt(nIndex, num)
ptArray.RemoveAt(1, 2); //remove starting from the element 1, two elements.
You Understand????
Best Regards
Carlos Antollini.
|
|
|
|
|
I agree with You.
I will give you a simple help.
For example:
The constructor of CArray is:
CArray<TYPE, TYPE>
Never forgot #include <afxtempl.h>
You can define
CArray<int,int> ptArray;
Or
CArray<MyClass, MyClass> ptArray;
ptArray.Add(20); //Add 20 as element 0
ptArray.Add(15); //Add 15 as element 1 in the array
ptArray.InsertAt(0, 23)); // New element 0
int num = ptArray.GetAt(1); //returns the element 1
int nSize = trArray.GetSize(); //returns the number of elements in the array.
you can append a array to another array
for example.
CArray<int, int> oArray;
oArray.Append(ptArray);
with removeAll you can delete all elements in the array.
ptArray.RemoveAll();
with RemoveAt() you can remove n elements in the array.
RemoveAt(nIndex, num)
ptArray.RemoveAt(1, 2); //remove starting from the element 1, two elements.
You Understand????
Best Regards
Carlos Antollini.
Carlos Antollini.
|
|
|
|
|
Yes I understand. Thanks! It looks alot like a list control. I'll play around with it.
Thanks for all your help!
Rob
|
|
|
|
|
I take it you've had CArray explained to you sufficiently, I'll only add that it is better to use vector from the STL for a myriad of reasons.
Christian
As I learn the innermost secrets of the around me, they reward me in many ways to keep quiet.
Men with pierced ears are better prepared for marriage. They've experienced pain and bought Jewellery.
|
|
|
|
|
Thanks Christian,
I looked into using stl vector a few weeks back, but it looks to be much more complicated to use.. at least for what I am trying to do. I think I'll stick with the CList in this project but I am defiantly going to study up on both the CArrays and STL Vectors so I can use either in a future project..
Thanks again!
Rob
|
|
|
|
|
STL *looks* complex at first, but it really isn't. By all means stick with what you know if you need to get something done, but it will definatley be worthwhile to investigate STL when you have time. Plenty of people here to ask if you get stuck.
Christian
As I learn the innermost secrets of the around me, they reward me in many ways to keep quiet.
Men with pierced ears are better prepared for marriage. They've experienced pain and bought Jewellery.
|
|
|
|
|
I'd "second" Christian's advice on STL std::vector (and std::list) - they are well worth the time to learn, are not actually all that complex, and will lead you into a whole range of new coding techniques and possibilities.
-----------------------
Reg : "Well, what Jesus blatantly fails to appreciate is that it's the meek who are the problem."
|
|
|
|
|
Hi
I have a problem :
When I finished my software in Visual C++ (It is about Winsock and ODBC) and it runs very well on my PC, I saw that in others PC that they haven't installed Visual Studio the software doesn't run.
I compilled my software like a static library but it doesn't run too
My question is How I can run my software in other PC then they haven't installed the Visual Studio?.
Thanks
--
Agusti Baubi
|
|
|
|
|
You need to Know what files do you need, for example:
If you are using MFC you need to distribuit the msvcrt.dll and mfc42.dll, if ypu are using odbc also you need to distribuit the odbc librarys, if that pc have not odbc, etc.
Best Regards....
Carlos Antollini.
|
|
|
|
|
Hello All,
I am creating a MFC Extension DLL (not regular DLL) to export MFC classes and checked the Automation option. However, the generated code is not sufficient to function as Automation client.
The DllGetClassObject/DllCanUnloadNow etc codes are not generated. Do I have to manually add this? If yes, what are the other necessary steps to take to conform to the MFC Automation structure? (for instance the regular DLL calls the COleObjectFactory::RegisterAll() in the CWndApp::InitInstance() method. Do I have to do something similar?)
Best regards,
Paul.
Paul Selormey, Bsc (Elect Eng), MSc (Mobile Communication) is currently Windows open source developer in Japan, and open for programming contract anywhere!
|
|
|
|
|
could any body help me in parsing Command Line argument. iwant to send DWORD ,DWORD, STRING. in form of "/5676/6766/test/" . is there any better way of doing that.
anshuman
anshuman
|
|
|
|
|
|
|
Do you know any class that can put a BMP as a background in a window??
I know that CpictureWindow here on CodeProject but I don't handle it!
Do you know a class that can do that!??
Nikado
|
|
|
|
|
What problems do you have with CPictureWindow
Do you want to tile this bitmap across the window, stretch the bitmap to fit the window or just paint it in the centre?
Michael
|
|
|
|
|
Try this
http://www.codeproject.com/docview/mditab.asp
A bit more than what you need but you can exact what you need from it.
Best regards,
Paul.
Paul Selormey, Bsc (Elect Eng), MSc (Mobile Communication) is currently Windows open source developer in Japan, and open for programming contract anywhere!
|
|
|
|
|
my application in Debug mode is asserting this & aborting
If this ASSERT fails, a bad pointer has been passed in. It may be
* totally bogus, or it may have been allocated from another heap.
* The pointer MUST come from the 'local' heap.
*/
_ASSERTE(_CrtIsValidHeapPointer(pUserData))
Kindly Help me
anshuman
|
|
|
|
|
You need to post your code that is causing the problem.
Michael
|
|
|
|
|
BOOL CEthnewApp::ParseCmdInfo(LPCSTR m_lpCmdLine)
{
char *str;
int nCnt[CMDLINE_ARGS],nStartIndex=0;
CString szCmdLineParam;
char szCmdLineParam1[CMDLINE_ARGS][12];
theApp.m_bDwnld = TRUE;
BOOL bSuccess = FALSE;
szCmdLineParam.Format("%s",m_lpCmdLine);
for(int Index=0;Index< CMDLINE_ARGS;Index++)
{
nCnt[Index] = szCmdLineParam.Find('/',(nStartIndex+1));
*szCmdLineParam1[Index] = _T('\0');
for(int j = nStartIndex,ii = 0;j<ncnt[index];j++,ii++)
{
="" szcmdlineparam1[index][ii]="szCmdLineParam.GetAt(nStartIndex+ii);
" }
="" ;
="" nstartindex="nCnt[Index]+1;
"
="" if(!strncmp(szcmdlineparam1[2],"~upl0001.tmp",12))
="" m_bdwnld="FALSE;
" m_dwhwnd="strtol(szCmdLineParam1[0],&str,16);
" m_lparam="strtol(szCmdLineParam1[1],&str,16);
" m_szupldfilename.format("%s",szcmdlineparam1[2]);
="" char="" buff[10];="" only="" for="" formmatting="" handler="" recognition="" need="" not="" to="" be="" changed="" able="" allocate="" buffer="" in="" release="" mode
="" wsprintf(buff,"%ld",m_dwhwnd);="" bsuccess="TRUE;
" else
="" dword="" dwtemp;
="" getting="" hwnd="" qmgr="" sending="" message="" qmgr
="" dwtemp="strtol(szCmdLineParam1[1],&str,16);" m_szdwldprjname.format("%s",(lpcstr)szcmdlineparam1[2]);
="" m_dwprotid="((dwTemp)&0xff00)">>8; // getting protocol ID selected in Setup of Qmgr
m_dwGPMachineID = (dwTemp)&0x00ff; // getting ddoID for panel selected in Qmgr.
m_szDwldPrjName.MakeUpper();
bSuccess = TRUE;
}
return bSuccess;
}
This code is for Command line parsing is there any other way of getting parsing done My command line arguments are "/6ee/4d2f/TEST/"
|
|
|
|
|
Which line of code is called before you get the assert?
>This code is for Command line parsing is there any other way of getting >parsing done My command line arguments are
The are a couple of command line parsers on code project, including
http://www.codeproject.com/cpp/caacommandlineclass.asp
Michael
|
|
|
|