|
I'm trying to make a little dialog to let the user search for a text string in a CEdit control on my main app's dialog. Like in Word or Notepad those kind of search windows. Does anyone have an idea on how to do this because i tried something myself and it didn't work at all (one of the reasons is that the CEdit::SetSel(...) didn't appear to work.)
Thanks
Kuniva
--------------------------------------------
God gave man a penis and a brain but not enough blood to make both of 'em work at the same time.
|
|
|
|
|
Kuniva wrote:
i tried something myself and it didn't work at all
It's better to mention what did you do
Kuniva wrote:
search for a text string in a CEdit control
Why don't you change it to RichEdit control,
it has more feature for text.
Mazy
"So,so you think you can tell,
Heaven from Hell,
Blue skies from pain,...
How I wish,how I wish you were here." Wish You Were Here-Pink Floyd-1975
|
|
|
|
|
Hi,
I have a .icm file.I would like to retreive the contents of the tag whose signature is "desc".
Any idea?
Neha
|
|
|
|
|
I jus opened a few icm files. They are not text files. They contain binary data and the postition of the description kept changing file to file, so did the file size. I suggest that you do a search to figure out the icm internal structure.
Nish
It's seven o'clock
On the dot
I'm in my drop top
Cruisin' the streets - Oh yeah
I got a real pretty, pretty little thing that's waiting for me
|
|
|
|
|
I have some code for this that I d/led online somewhere, but it's at work. I'll post the link when I get back to the office on Monday.
Yeah I know, get a VPN right? Oops!
Jeremy L. Falcon
"The One Who Said, 'The One Who Said...'"
|
|
|
|
|
|
I have a need to do the following item and could use some help setting it up. I have a basic MFC application running that includes a prebuilt MFC dialog derived class for allowing the user to input data. this all works fine. I need, however, to allow the user to create their own MFC based dialog box, and then allow them to call that dialog box at runtime without the primary application being aware of the dialogs design. So what I have done is this...
in main app, when i select menu item 'test' it looks for a dll named 'testing.dll', and if it finds it, then it loads the dll, finds a function called Create() and attempts to run it. this works fine.
in the create() function, it is a simple test for now.
char gString[255] = "";
void Create()
{
CMyDialog d;
if (d,DoModal() == IDOK)
strcpy(gString,"everything worked fine");
}
all of the exporting works fine, it does loading the dll, finding the create function, retrieving the gString variable etc... the only thing that doesnt work as expected, is in the DoModal() call of the dialog class. the dialogbox appears, and then the entire program crashes. This doesnt happen if i create a simple dialog box that is not CDialog derived.
Am I missing something on MFC? is there an issue with trversing a dll boundary with the MFC.
thanks in advance for any info.
|
|
|
|
|
Anonymous wrote:
CMyDialog d;
if (d,DoModal() == IDOK)
strcpy(gString,"everything worked fine");
This won't work.
You have not associated a dialog resource. Without doing that DoModal() will fail.
Nish
It's seven o'clock
On the dot
I'm in my drop top
Cruisin' the streets - Oh yeah
I got a real pretty, pretty little thing that's waiting for me
|
|
|
|
|
sorry but i am not sure what you mean exactly.
In the dll I created, there is a class definition of an MFC CDialog derived class. I should have written this from home, I will post my code when i get there. but the class 'should' be all inclusive, as it runs fine in a native MFC application. anyhow, when i get the code posted maybe my question will make more sense
|
|
|
|
|
Oh!
I apologize for misinterpreting your question.
Yes, please post a little more code, so that it might be easier to locate the problem.
Thanks
Nish
It's seven o'clock
On the dot
I'm in my drop top
Cruisin' the streets - Oh yeah
I got a real pretty, pretty little thing that's waiting for me
|
|
|
|
|
Is testing.dll an 'extension dll'? If you're creating a dll which uses MFC, you have three options - DLL using static MFC, 'regular' DLL using MFC in DLL and 'extension' DLL which shares MFC data with your .exe file and with other 'extension' dlls.
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
ok, a little code to go with this mess I have
// ******************************************************************
// MFCTestDll4.dll is a MFC extension dll.
#define MFCTESTDLL4_API __declspec(dllexport)
// used for determining of dll contains deObject definitions
extern "C"
{
MFCTESTDLL4_API char* GetData();
MFCTESTDLL4_API void SetData(char* data);
MFCTESTDLL4_API void CreateMyDialog(char* name);
}
// **********************************************************************
// the dll code is like this
// MFCTestDLL4.cpp : Defines the initialization routines for the DLL.
//
#include "stdafx.h"
#include <afxdllx.h>
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
static AFX_EXTENSION_MODULE MFCTestDLL4DLL = { NULL, NULL };
extern "C" int APIENTRY
DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved)
{
// Remove this if you use lpReserved
UNREFERENCED_PARAMETER(lpReserved);
if (dwReason == DLL_PROCESS_ATTACH)
{
TRACE0("MFCTESTDLL4.DLL Initializing!\n");
// Extension DLL one-time initialization
if (!AfxInitExtensionModule(MFCTestDLL4DLL, hInstance))
return 0;
// Insert this DLL into the resource chain
// NOTE: If this Extension DLL is being implicitly linked to by
// an MFC Regular DLL (such as an ActiveX Control)
// instead of an MFC application, then you will want to
// remove this line from DllMain and put it in a separate
// function exported from this Extension DLL. The Regular DLL
// that uses this Extension DLL should then explicitly call that
// function to initialize this Extension DLL. Otherwise,
// the CDynLinkLibrary object will not be attached to the
// Regular DLL's resource chain, and serious problems will
// result.
new CDynLinkLibrary(MFCTestDLL4DLL);
}
else if (dwReason == DLL_PROCESS_DETACH)
{
TRACE0("MFCTESTDLL4.DLL Terminating!\n");
// Terminate the library before destructors are called
AfxTermExtensionModule(MFCTestDLL4DLL);
}
return 1; // ok
}
#include "MFCTestDLL4.h"
#include "testdialog4.h"
#include "DE3DUtils.h"
char gData[10000] = "testing the data stream";
MFCTESTDLL4_API char* GetData()
{
Log("Inside DLL, GetData()");
return gData;
}
MFCTESTDLL4_API void SetData(char* data)
{
Logf("Inside DLL, SetData(%s)",data);
strcpy(gData,data);
}
MFCTESTDLL4_API void CreateMyDialog(char* name)
{
Logf("Inside DLL, CreateMyDialog(%s)",name);
TestDialog4 t;
Log("Inside DLL, TestDialog t");
if (t.DoModal() == IDOK)
{
Log("Inside DLL, DoModal == IDOK");
SetData("Hello world we picked the idok button");
}
Log("Inside DLL, After dialog");
}
// **********************************************************************
// now, in my main app i do this
// find the dialog dll
// attempt to load the dll
char filename[255] = "resourcedll\\MFCTestDLL4.dll";
HMODULE hwnd = LoadLibrary(filename);
if (!hwnd)
{
// something went wrong when loading the DLL
Log("Unable To Load Resource Library",filename);
return;
}
else
{
// we have a good library to use
Log("Resource Library Loaded",filename);
}
// set the data
typedef void (*SETDATA)(char*);
SETDATA SetDataProc = (SETDATA) GetProcAddress(hwnd, "SetData");
if (!SetDataProc)
{
Log("Unable to locate SetData Function");
return;
}
else
{
Log("SetData Function located");
SetDataProc("from the main app");
}
// run the dialog
typedef void (*CREATEMYDIALOG)(char*);
CREATEMYDIALOG CreateMyDialogProc = (CREATEMYDIALOG) GetProcAddress(hwnd, "CreateMyDialog");
if (!CreateMyDialogProc)
{
Log("Unable to locate CreateMyDialog Function");
return;
}
else
{
Log("CreateMyDialog Function located");
CreateMyDialogProc("TestDialog");
}
// get the data
typedef char* (*GETDATA)();
GETDATA GetDataProc = (GETDATA) GetProcAddress(hwnd, "GetData");
if (!GetDataProc)
{
Log("Unable to locate GetData Function");
return;
}
else
{
Log("GetData Function located");
char s[255];
strcpy(s,GetDataProc());
}
// **********************************************************************
// after all of this, my log file looks like this...
Resource Library Loaded - resourcedll\MFCTestDLL4.dll
SetData Function located - (null)
Inside DLL, SetData(from the main app) - (null)
CreateMyDialog Function located - (null)
Inside DLL, CreateMyDialog(TestDialog) - (null)
Inside DLL, TestDialog t - (null)
// and i get a nice little windows messagebox telling me i screwed up
as you can see from the log file, it is during the DoMocal() call that I have the trouble.
any thoughts?
|
|
|
|
|
The Problem is --Where and How to Delete the created objects with "new" Operator
Please mark the palce and solution..
i tried with somany ways but i am getting "Heap assertion"
and in Debugging mode it is showing MemoryLeak Detected
as follows:
Detected memory leaks!
Dumping objects ->
{172} normal block at 0x002F5F88, 500 bytes long.
Data: <d:\projects\dump> 44 3A 5C 50 72 6F 6A 65 63 74 73 5C 44 75 6D 70
and also i am getting the
First-chance exception in MyApp.exe (KERNEL32.DLL): 0x000006B5: (no name).
please give me the solution
I am very much worring about these problems please please....
This is Mycode:
I am declaring structures as follows:
1.For Database entries:
;;;;;;;;;;;;;;;;;;;;;;;
typedef struct{
char strName[MAX_PATH];
int nNumber;
int nCode;
}DB_DATA;
2:For Daily entries:
;;;;;;;;;;;;;;;;;;;;
typedef struct{
char strName[MAX_PATH];
int nNumber;
int nCode;
}DAILY_DATA;
Now i am using CTypedPtrList as follows:
1.For Database:
===============
typedef CTypedPtrList<cptrlist,db_data*> DB_DATA_LIST;
DB_DATA_LIST m_lstDbData;
2.For Initial List:
==================
typedef CTypedPtrList<cptrlist,daily_data*> INITIAL_LIST;
INITIAL_LIST m_InitialList;
3.For Priority List:
====================
typedef CTypedPtrList<cptrlist,daily_data*> PRIORITY_LIST;
PRIORITY_LIST m_PriorityList;
Initially i am getting all the data from database and store it in "m_lstDbData"
as follows:
############
while (EndOfFile)
{
DB_DATA * dbdata=new DB_DATA;
strcpy(dbdata->sName,rs.sName);
dbdata->nNumber=rs.nNumber;
dbdata->nCode=rs.nCode;
m_lstDbData.AddTail(dbdata);
MoveNext();
}
Preparing the InitialList as follows:
`````````````````````````````````````
Now i am checking the Dialy Register(one Text file contains record wise data) if
Daily Register values mactched with Database values then stored this values into InitialList.
do
{
POSITION nPos=m_lstDbData.GetHeadPosition();
for(int nPass=0;nPass<m_lstdbdata.getcount();++npass)
{=""
="" db_data="" *="" tempdbdata="new" db_data;="" if(dialyreg="" ncode="=tempDbdata-">nCode)
{
DAILY_DATA * tempDailyData=new DAILY_DATA;
strcpy(tempDailyData->sFileName,str);
tempDailyData->nNumber=tempDbdata->nNumber;
tempDailyData->nCode=tempDbdata->nCode;
InitialList.AddTail(tempDailyData);
}//end if(DialrRegCode==tempDbdata->nCode)
m_lstDbData.GetNext(nPos);
}//end for(int nPass=0;nPass<m_lstdbdata.getcount();++npass)
="" }while(endof="" daily="" reg);="" this="" is="" do="" while="" loop=""
<<<<<<<<<<<<<<<<<<<<<<<<<="">>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Next I am preparing PriorityList according the nCode(assending):
````````````````````````````````````````````````````````````````````
while(!InitialList.IsEmpty())
{
POSITION nPos=InitialList.GetHeadPosition();
DAILY_DATA * TempHeadPosData=new DAILY_DATA;
TempHeadPosData=InitialList.GetAt(nPos);//Head Position Priority
nStuctPos=InitialList.Find(TempHeadPosData);
nHPosCode=TempHeadPosData->nCode;
for(int nIndex=0;nIndex<initiallist.getcount();nindex++)
{
="" daily_data="" *="" tempnextposdata="new" daily_data;
="" nnextposcode="TempNextPosData-">nCode;
if(nHPosCode>nNextPosCode)
{
nStuctPos=InitialList.Find(TempNextPosData);
int nTempHold=nHPosCode;
nHPosCode=nNextPosCode;
nNextPosCode=nHPosCode;
}//end if(nHPosCode>nNextPosCode)
else
{
if(nHPosCode==nNextPosCode)
{
//here i am doing somethine
}//end if(nHPosCode==NextPosPriority)
}//end else
}//end for(int nIndex=0;nIndex<initiallist.getcount();nindex++)
="" daily_data="" *="" tempnewdata="new" daily_data;
=""
="" prioritylist.addtail(tempnewdata);
="" initiallist.removeat(nstuctpos);
="" }="" end="" while(!initiallist.isempty())
finally="" i="" am="" getting="" the="" data="" from="" prioritylist="" and="" send="" it="" to="" mydll(mydll="" do="" update="" database)=""
``````````````````````````````````````````````````````````````````````````````````````````````````
while(!prioritylist.isempty())
="" {
="" position="" pos="PriorityList.GetHeadPosition();
" filedata="new" strtemp.format("%s",filedata-="">szName);
nCode=filedata->nCode;
if(nCode>=1)
{
//call MyDll
PriorityList.RemoveAt(Pos);
}//end if(nCode>=1)
else
{
PriorityList.RemoveAt(Pos);
}
strTempPath=strPath;
}//end while(!PriorityList.IsEmpty())
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Now the Problem is --Where and How to Delete the created objects with "new" Operator
Please mark the palce and solution..
i tried with somany ways but i am getting "Heap assertion"
and in Debugging mode it is showing MemoryLeak Detected
as follows:
Detected memory leaks!
Dumping objects ->
{172} normal block at 0x002F5F88, 500 bytes long.
Data: <d:\projects\dump> 44 3A 5C 50 72 6F 6A 65 63 74 73 5C 44 75 6D 70
and also i am getting the
First-chance exception in MyApp.exe (KERNEL32.DLL): 0x000006B5: (no name).
please give me the solution
I am very much worring about these problems please please....
anju
|
|
|
|
|
hi:
how to get the whole URLs form the intetnet shortcuts(the file in c:\windows\history)?
Thanks
benben
|
|
|
|
|
I haven't used them but these calls might be just what you would want :-
FindFirstUrlCacheEntry,
FindNextUrlCacheEntry
Nish
It's seven o'clock
On the dot
I'm in my drop top
Cruisin' the streets - Oh yeah
I got a real pretty, pretty little thing that's waiting for me
|
|
|
|
|
check the IUrlHistoryStg Interface & the STATURL Structure
|
|
|
|
|
How do I add a class thru classwizard and derive it from CWnd... so I can also get Windows message handlers....
What i'm doing is i add it through the Inser->New Class menu in Visual C++ and enter Generic CWnd as Base Class... Then i manuall edit the header file of my class, replace a generic Cwnd to another base class (i.e. public MyClass, public BaseClass)... if my base class is some class that is inherited from CWnd, which means it has windows message handlers... But, I cannot see my new dervived class in ClassWizard....
What i want to do is i want to appear my new derived class to classWizard......
|
|
|
|
|
I think you have to add those files to your project,also if you use classwizard,you can find add new class button there.
Mazy
"So,so you think you can tell,
Heaven from Hell,
Blue skies from pain,...
How I wish,how I wish you were here." Wish You Were Here-Pink Floyd-1975
|
|
|
|
|
Try to delete .clw file - ClassWizard will regenerate the file next time you invoke it; changes should be visible.
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
So if I derived a class from another class that inherits from a CWnd, my derived class would be visible in the CLASSWIZARD??
Thanks....
|
|
|
|
|
Classwizard is weird... you have to destroy it's toys for it to looks for new ones...
|
|
|
|
|
Hi all,
I'm writting a program on Win2000 OS.
I have a strange problem in my program, it is about getting Hijri date from OS.
In first i must tell you something about Hijri calendars.
For example today is 2002/02/03 (yyyy/dd/mm) in English calendars ...
Today is 1422/12/17 (yyyy/mm/dd) in Arabic calendars ...
And i must tell you that some Arabic calendars have some difference with togethers ...
For example, probably Windows show you 1422/12/18 !!!
For solving this, Microsoft predicted a tools in Ragional Options which called Adjust Hijri date to: ......
In this list you can solve a few problems ...
In this list you can see:
1422/12/15
1422/12/16
1422/12/17 <--- right date !
1422/12/18
1422/12/19
1422/12/20
Well, first i changed my caledar to Hijri Calendar from Regional Options.
and i solved the problem in Hijri date (by Adjust Hijri date to: ......).
Now, my computer show right Hijri date.
Let me tell you about my source code.
I'm using of this code for getting Hijri date:
CString GetHijriDate()
{
// This function uses for converting English date to Hijri date !
SYSTEMTIME st;
GetLocalTime(&st);
DATE dt;
SystemTimeToVariantTime(&st, &dt);
BSTR bsValue;
VarBstrFromDate(dt, NULL, VAR_CALENDAR_HIJRI | VAR_DATEVALUEONLY, &bsValue);
CString strResult(bsValue);
return strResult;
}
But unfortunly, my program return 1422/12/18 still !!!!!
That must return 1422/12/17
What is the wrong ?!
Is there any other way for getting right Hijri date ?
Help me, please
My month article: Game programming by DirectX by Lan Mader.
Please visit in: www.geocities.com/hadi_rezaie/index.html
Hadi Rezaie
|
|
|
|
|
Yesterday someone was complaining that he couldnt get his window to get the focus. This is a Win2K setting that can be changed by modifying this registry entry.
Key:- HKEY_CURRENT_USER\Control Panel\Desktop
Value :- ForegroundLockTimeout
By default it will be 30d40.
Change this to 0.
Thanks
Nish
p.s. Users might be annoyed if you change their settings without their permission. So be careful how you use this info.
It's seven o'clock
On the dot
I'm in my drop top
Cruisin' the streets - Oh yeah
I got a real pretty, pretty little thing that's waiting for me
|
|
|
|
|
Hi.
I began study MFC programming from Prosise two months ago. I finished the first two part of the book and will begin Part III. To be honest, I still cannot design a program of *my own* and implement it using MFC.
I read reviews about MFC books including Prosise, Jones, and Deitel. I see again and again that one of the most difficult part of teaching MFC is to *not* discuss AppWizard and ClassWizard. Prosise does it by chapter 4. Nonetheless, Prosise's book is an ideal MFC *reference*.
Anyways, I learned quite a bit from reading the first two part. I really appreciate the document/view architecture. I want to start implementing my win32 console programs into MFC so bad. I can just *feel* it, but I cannot get it done. There are many missing pieces in this puzzle. I can picture the final results, but there are so many missing pieces (how?, why?, what?, when?). I have no idea how to gather all the missing pieces.
I first began programming (ever) as well as programming using C++ last fall semester. C++ caught my interest quick. Learning MFC, for some reason, is not the same. I cannot apply the same formula of *diving in*, which was how I became so proficient with C++ in both design and implementation. I can solve most problems using C++ (except for big projects). One reason, I think, is because there are *too many tools* in MFC. I can say I have seen close to just about everything there is to see in C++. I tried again and again to get apply the same strategy to MFC, but it does not seem to work.
So here I am, beginning Part III from Prosise's book and howing no is lost. What are my options?
I can considering Jones' Introduction to MFC Programming with
Visual C++. If nothing else works, I will most likely go a different direction (Jones) and then return to Promise.
Kuphryn
|
|
|
|
|
Hello
I think you might start creating some sample apps and when you get stuck you might post a doubt here or on any other C++ forum online. I guess people would be able to help you with individual issues a lot better than they'd be able to help you assimilate MFC as a whole.
And good luck...
Nish
It's seven o'clock
On the dot
I'm in my drop top
Cruisin' the streets - Oh yeah
I got a real pretty, pretty little thing that's waiting for me
|
|
|
|
|