|
You have to read the whole file into memory, then you can change it according to any rules you like, and then overwrite the file with the new, edited data. I don't know why you think you need to insert a *, but you really don't.
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Hello dear friends,
How do we enable the toolbar to communicate with the webpage.
Suppose I've one interface method in toolbar's dll.
How can I call this method from the webpage that has one button
say "Edit".
When I click the "Edit" button in the webpage the toolbar dll's interface
method should be called.
How we can do this?
Thanks in advance to all.
ritz1234
|
|
|
|
|
hi
i have an error link saying that :
Linking...
File_Commands.obj : error LNK2001: unresolved external symbol "int __cdecl RegSetValueExString(struct HKEY__ *,class CString,int,int,class CString,int)" (?RegSetValueExString@@YAHPAUHKEY__@@VCString@@HH1H@Z)
File_Commands.obj : error LNK2001: unresolved external symbol "int __cdecl RegQueryValueExString(struct HKEY__ *,class CString,int,int &,class CString,int &)" (?RegQueryValueExString@@YAHPAUHKEY__@@VCString@@HAAH12@Z)
File_Commands.obj : error LNK2001: unresolved external symbol "int __cdecl RegQueryValueExNULL(struct HKEY__ *,class CString,int,int &,int,int &)" (?RegQueryValueExNULL@@YAHPAUHKEY__@@VCString@@HAAHH2@Z)
//***************************************************************//
knowing that those functions are declared int header file like that:
int RegQueryValueExString (HKEY hKey, CString lpValueName, int lpReserved, int& lpType, CString lpData, int& lpcbData);
int RegQueryValueExNULL (HKEY hKey, CString lpValueName, int lpReserved, int& lpType, int lpData, int& lpcbData);
int RegSetValueExString (HKEY hKey, CString lpValueName, int Reserved, int dwType, CString lpValue, int cbData);
<br />
and they are declared in the .cpp file as the following:<br />
<br />
lRtn = RegQueryValueExNULL(hKey, "", 0, lRtype, 0, lCdata);<br />
sValue = CString(lCdata,0);<br />
<br />
lRtn = RegQueryValueExString(hKey, "", 0, lRtype, sValue, lCdata);<br />
<br />
lRtn = RegSetValueExString(hKey, "", 0, REG_SZ, sValue, lsize);
//**********************************************//
when i compile ......0 errors
but when runing 3errors
what should i do ?
thanks in advance
lahom
|
|
|
|
|
lahom wrote: //***************************************************************//
knowing that those functions are declared int header file like that:
// Registry API To Query A String Value.
int RegQueryValueExString /* RegQueryValueExA */ (HKEY hKey, CString lpValueName, int lpReserved, int& lpType, CString lpData, int& lpcbData); // "advapi32.dll"
is this some thing tried to port from VB. It seems attempt to port alias in VB declaration. The definitions of the functions are not available.
you replace RegQueryValueExString with RegQueryValueExA (similarly other 2) in cpp where you are calling it.
or comment out those declarations in header and define the Macros like,
#define RegQueryValueExString RegQueryValueExA
#define RegQueryValueExNULL RegQueryValueExA
#define RegSetValueExString RegSetValueExA
|
|
|
|
|
lahom wrote: but when runing 3errors
You've shown linker errors, but what are these runtime errors you refer to?
"Love people and use things, not love things and use people." - Unknown
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
DavidCrow wrote: What errors?
3 link errors
lahom wrote: i have an error link saying that :
|
|
|
|
|
DavidCrow wrote: You've shown linker errors, but what are these runtime errors you refer to?
without linking cannot run the program, make no sense.
lahom wrote: when i compile ......0 errors
but when runing 3errors
when run IDE tries to link ... link error.
|
|
|
|
|
My application has a main window that provides most of the functionality. The window itself is nice and clean, and very user friendly IMO. However, the class CPP file for it is growing large and hard to navigate (I have to use Ctrl+F to find most functions). The reason for this is there are a lot of possible interactions the user can have with the interface, each having a unique function. The .cpp file is currently 24kb (845 lines including whitespace); which is a lot for me, I usually don't write large programs.
I want to try to keep the code organized, and I'd like to know some good practices for doing this. (If I become a programmer as a job, I want to know how to make the code "presentable" and not just a mess.) Is it just a matter of trying to keep the functions sorted in groups (i.e. everything having to do with interaction of the list control together, then everything with the media player together, etc.. etc..) Or is there more that I can do to try to keep it organized?
Lastly, Visual Studio 2008 defaults to making wizard generated message handlers public. I would think that they should be protected in most cases. Is there a convention here that I'm not aware of, or should I indeed move the ones that other classes shouldn't be calling to protected?
Thanks again for any info!
|
|
|
|
|
Well, one way you could organize your code is by separating out functionality into different classes.
There are many ways to "break it up", but just separating out your business or application logic from the UI might be a good starting point.
- S
50 cups of coffee and you know it's on!
|
|
|
|
|
Well, 845 lines is not so much, my last programm was about 15000 (all together).
I like to separate functionalities a lot. Like a module/class to save datas, another for mathematical functions, another for GUI functions, another for "various" functions and so on.
But at the end, the only one that can make it right, is you. Because every programm is different and is a bit difficult to say something "standard"
x87Bliss wrote: i.e. everything having to do with interaction of the list control together, then everything with the media player together, etc.. etc..)
Of course making groups regarding functionalities is a great idea, but it may be a project where another aproach is better.
Greetings.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
“The First Rule of Program Optimization: Don't do it. The Second Rule of Program Optimization (for experts only!): Don't do it yet.” - Michael A. Jackson
|
|
|
|
|
Besides just making classes for specific functionality, I also decided to start using '#pragma region' directives; so I can collapse groups of functions together. It's been very useful.
I barely know anything about pragma statements. In my case I don't have to worry about it, since I will be using Visual Studio always to compile this. I am just wondering what would happen if a different compiler saw '#pragma region' if it'd skip over it, or have an error?
|
|
|
|
|
x87Bliss wrote: I am just wondering what would happen if a different compiler saw '#pragma region' if it'd skip over it, or have an error?
"If the compiler finds a pragma it does not recognize, it issues a warning, but compilation continues" from msdn
or something like,
#if _MSC_VER > version
#pragma region Region_1
#endif
x87Bliss wrote: the class CPP file for it is growing large and hard to navigate (I have to use Ctrl+F to find most functions).
845 is not so lengthy, you can learn some shortcuts to speed up search. for instance you can use indexed search (ctrl + i) and type to search while typing. and to navigate to class and member in a file, the code view has scope and member field or class view you can select to navigate to the function, F12 a handy shortcut to navigate to the definition from its reference...
You may redesign the GUI into different layouts or split GUI into pages if you have tomany controls that will be annoying the user. If your GUI is neat, may be you group range of event handlers that is handled in different class implemented in different files like ON_CONTROL_RANGE, ON_COMMAND_RANGE, ...
|
|
|
|
|
Thanks That's some of the most useful info I've seen. The F12 will definitely come in handy.
|
|
|
|
|
I will be taking VisualC++ in a few weeks and was wondering what i should get prepared for as in reading and difficulty level? I know it's not easy for if it was i would not waste money, but as to hard i mean terminology and functions, etc. whats difficult about it? I complete c++ in two weeks and will retake it in the fall. I had difficulty understanding 1,890 pages in just a few months, and almost got the theory down but not comfortable with a passing grade or the knowledge I lack. So is VC++ just about the same? also since viewing and joining this site I've advanced my skills dramatically.
Thanks
|
|
|
|
|
Visual C++ is the name given to the Microsoft C++ compiler. Nowadays, it's hard to know for sure, but I'd guess they are going to teach you MFC. MFC is a set of classes that you use to build windows programs in C++. So, it's C++ code, but some additional libraries and classes that help you write windows specific code. The other option nowadays is C++/CLI, which is a lot messier, and a lot less used. I'd ask for the course notes first, so you google the right thing, but I expect it's most likely MFC. If they are using VC6, it's MFC. if they are using an Express Edition of Visual C++, then it's C++/CLI ( as MFC is not supported by the free versions ).
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
impossible to answer.
I'm not certain I understand what is your current status in regard to programming ?
You did take some course ? what was the platform ? what environment ?
Be assured that not many people can "learn" 1890 pages in a few months.
good luck.
|
|
|
|
|
Microsoft Visual Studio 6.0 is the course I want to take on this summer. The main reason why I'm inquiring about the difficulty is that summer college sessions are fast paced and are 5 days a week. I'm not accomplished in microsoft visual c++, even though I am about finished for this semester. so is MVS 6.0 as complicated as MV C++?
|
|
|
|
|
We currently have a very large app that uses MFC DAO and MS Jet for a backend. We need to move the whole thing to a SQL server back end and want to do it as quickly as possible without losing performance. We tried going to CRecordset and ODBC but 2 problems came up right away...Poor performance and no FindFirst/FindNext capability. So I have 2 questions...
1. Can anyone suggest the best connection for performance (OLE DB maybe ??) ?
2. Does anyone have any ideas about how to do an indexed search through a result set (like a FindFirst) to locate a particular record without the slow FetchNext/MoveNext etc.
Thanks
|
|
|
|
|
|
Thank You for responding...
We've read the doc and already did some testing that's why we're leaning towards OLE DB. Both DAO (connected to SQL Server) and ODBC (CDatabase/CRecordset) have much poorer performance than DAO w/MS Jet and the non .Net ADO seems to be just another layer to slow things down.
Question #2 then becomes a bigger issue as to the amount of code that needs to be changed/redesigned.
Thanks
|
|
|
|
|
Stevej wrote: and the non .Net ADO seems to be just another layer to slow things down.
Slowing things down can originate from far more than just the Data Access Library you are using since you changed from a Jet engine to SQL Server. How sure are you that you have optimized your use of the Database engine[^] itself?
That said, I have used ADO for years and never found the Filter mechanism to be slow, but "slow" is a relative term so that doesn't really help.
Stevej wrote: Question #2 then becomes a bigger issue as to the amount of code that needs to be changed/redesigned.
Stevej wrote: Without FindFirst/FindNext we are looking a quite a bit of code to modify.
Should your analysis prove that it would be prudent to encapsulate say the ATL ADO generated wrappers in your own library that implements FindFirst/FindNext for the application level code, I see no reason you should not be able to do that.
led mike
|
|
|
|
|
Stevej wrote: ...no FindFirst/FindNext capability.
What about MoveFirst() and MoveNext() ?
Stevej wrote: 2. Does anyone have any ideas about how to do an indexed search through a result set (like a FindFirst) to locate a particular record without the slow FetchNext/MoveNext etc.
Isn't that what the WHERE clause is for?
"Love people and use things, not love things and use people." - Unknown
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
MoveFirst MoveNext are too slow. You'd have to paw through the whole result set to find one particular record. If we were to re-write from scratch there would not be an issue. Yes the WHERE clause sets an initial filter but within that result set their may be another subfilter needed. Our existing code uses CDaoRecordsets and takes full advantage of the FindFirst/FindNext capability. For example. Our jobs are broken up by phases so an initial filter for the WHERE clause may be WHERE PHASE = FIRSTPHASE. Within that phase there are several subheadings that need special processing. Currently using CDaoRecordset::FindFirst (..) there is no need to do a requery as the indexed find is very fast. Without FindFirst/FindNext we are looking a quite a bit of code to modify. We were quite surprised to find that CRecordset did not have these although for performance reasons CRecordset doesn't seem a viable option anyway. - Thanks
|
|
|
|
|
I've tried to find code that would show me how to load MS Word and other programs from within my program. Does anyone have such code or a link to it?
Thanks in advance.
A C++ programming language novice, but striving to learn
|
|
|
|
|
See here.
"Love people and use things, not love things and use people." - Unknown
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|