|
Do this:
// open the file
fstream f("filename.ext",ios::in|ios::binary);
// set the file pointer to end
f.seekg(0,ios::end);
// get the current position which will be the size
len = f.tellg();
// reset the pos
f.seekg(0);
//close the file
f.close();
|
|
|
|
|
Hi all!
I m using a dll into my dialog based application.
Now, in the next step, i want to access a class from my dialog based application into that dll.
Is it possible?
If yes, then how?
Regards
Usman Arif
Usman Arif
|
|
|
|
|
Here's an example. This is in your header file. You will need to change the obvious defines etc to suit your own app.
#ifdef MYCLASS_EXPORTS
#define MYCLASSDDLL __declspec(dllexport)
#else
#define MYCLASSDDLL __declspec(dllimport)
#ifdef _DEBUG //linkage
#pragma comment (lib, "myclass_db.lib")
#else
#pragma comment (lib, "myclass.lib")
#endif
#endif
//
// class definition
//
class MYCLASSDLL CMyClass {
}
|
|
|
|
|
I can't get 2004 or 2005 projects to compile in VS2003 mfc71.dll. It keeps looking for mfc70.dll?
How did you resolve this?
I'm not an expert yet, but I play one at work. Yeah and here too.
|
|
|
|
|
The short of it, you can't. You need VS2002.
--
Joel Lucsy
|
|
|
|
|
yeah, unfortunately. could you answer my AcDatabase question though
I'm not an expert yet, but I play one at work. Yeah and here too.
|
|
|
|
|
Sure, what is the question?
--
Joel Lucsy
|
|
|
|
|
|
says user Acad AcDatabase in the subject
I'm not an expert yet, but I play one at work. Yeah and here too.
|
|
|
|
|
hi all,
my code has managed to get out of synch with visual studio.net - making stepping through the code bascially impossible
any ideas what to do so i can debug properly?
bryce
---
To paraphrase Fred Dagg - the views expressed in this post are bloody good ones.
--
Publitor, making Pubmed easy.
http://www.sohocode.com/publitor
Our kids book :The Snot Goblin
|
|
|
|
|
This normally means that you have a stray out-of-date PDB file somewhere, or that a DLL is being loaded from a different path to the one you expected. Try doing a Rebuild All to fix the first problem. For the second problem, check where your DLLs are loading from, using something like Process Explorer[^]. Check that these are correct and up-to-date, and that the corresponding PDB files are in the same directories (I think).
Stability. What an interesting concept. -- Chris Maunder
|
|
|
|
|
yeah the rebuild/clean was the first thing i tried,
so its not a pdb thing
there no other dll's being loaded...darn
Bryce
---
To paraphrase Fred Dagg - the views expressed in this post are bloody good ones.
--
Publitor, making Pubmed easy.
http://www.sohocode.com/publitor
Our kids book :The Snot Goblin
|
|
|
|
|
Are you trying to debug an optimized program? Sometimes when it optimizes, it moves around statements so they will execute out of order. Hope this helps.
--
Marcus Kwok
|
|
|
|
|
nope its not ever been built in release mode, and im using the default settings
another weird thing is, the debugger will allow me to put in breakpoints at various places,. but not others - the breakpoints turn into those "?"mark types and when moused over the message says
"the breakpoint will not currently be hit"
Bryce
---
To paraphrase Fred Dagg - the views expressed in this post are bloody good ones.
--
Publitor, making Pubmed easy.
http://www.sohocode.com/publitor
Our kids book :The Snot Goblin
|
|
|
|
|
Do you have multiple copies of source/header files? Are you editing one copy, and then compiling a different copy into your exe? I did that once and experienced the same thing you are experiencing now. Check the file properties of the files you are having troubles in to make sure the complete path is the path you expect it to be.
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
"Obviously ??? You're definitely a superstar!!!" mYkel - 21 Jun '04
Within you lies the power for good - Use it! Honoured as one of The Most Helpful Members of 2004
|
|
|
|
|
hi dude
i rebuilt the applicaiton from scratch andhavebeen checking it as i go
some weird things still happening - using CFileDalog for example causes the code to get out of step!
I thought all this very srange so i uninstalled and reinstalle VS.net...same problem
Any thoughts?
Bryce
---
To paraphrase Fred Dagg - the views expressed in this post are bloody good ones.
--
Publitor, making Pubmed easy.
http://www.sohocode.com/publitor
Our kids book :The Snot Goblin
|
|
|
|
|
bryce wrote:
Any thoughts?
Unfortunately no,
I still say go back and make sure you are actually building into your app the files you think you are. VC6 has an option that lists all of the files included in the project, I believe VS.NET uses the solution explorer to do the same thing. Check there for any "external dependencies". There it should list files that are being built into your app that are not part of the project.
Another thing you could try is using window's search to check your harddrives for any additional copies of the files that are out of synch. It could be that the compiler is grabbing one of them instead of the one you have open in the editor.
Without actually being at your computer that is all I can suggest.
Sorry if that is no help
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
"Obviously ??? You're definitely a superstar!!!" mYkel - 21 Jun '04
Within you lies the power for good - Use it! Honoured as one of The Most Helpful Members of 2004
|
|
|
|
|
I had the same problem, and I found out that the 'time-stamp' of some files were in the future (due to some file-sharing we have here at work) and caused
this problem.
The solution was to 'touch' all files and then rebuild the sources.
Hope it helps.
-- Ricky Marek (AKA: rbid)
-- "Things are only impossible until they are not" --- Jean-Luc Picard
My articles
|
|
|
|
|
hi guys,
i have used unistd.h file in one of my header file , on compilation in VC++ it cannot find this file. can i use this in file VC++.
can anybody help me on this.
Cheers.
sudharma
|
|
|
|
|
unistd.h is a POSIX header file. The Win32 API does not include POSIX functions. The Microsoft C run-time includes some POSIX-like functions prefixed with an underscore (e.g. _access() rather than access() ). However some of these functions - particularly the _exec family - have somewhat different behaviour to the POSIX equivalent.
In the POSIX standard, the exec family load an executable image into the current process and execute it. To create a new process, you call fork . The Microsoft C run-time _exec family create a new process and execute the specified executable. The Win32 subsystem does not permit the POSIX exec behaviour.
Most of the MS CRT I/O routine equivalents can be found in io.h .
Stability. What an interesting concept. -- Chris Maunder
|
|
|
|
|
here is it,the Defination of Unistd.h
#ifndef _UNISTD_H
#define _UNISTD_H
#include <io.h>
#include <process.h>
#endif /* _UNISTD_H */
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
|
|
|
|
|
Any idea how to embed an exectuable inside another executable, and then from with in your program, call the embeded exectuable with out creating another process or wrting the embed exectuable to disk?
I have a C++ program (straight C++, not managed). It has some logic and then depending on a number of conditions, ShellExecute()s another exectble file (client.exe), which happens to be a .net file. Is there anyway that I can add this client.exe file as a resource of my C++ program, and then call the beginning of the code from within the C++ program, so I wouldn't have to extract the resource or create a new process
Please help
Thanks,
Jason A. Donenfeld
PS: This is what I have now:
<br />
#define WIN32_LEAN_AND_MEAN <br />
#include <windows.h><br />
#include <tchar.h><br />
#include <shellapi.h><br />
<br />
#define INSTANCEMESSAGE "ShowZIM"<br />
#define WINDOW_TITLE "ZX2C4InstantMessenger"<br />
#define MUTEX_STRING "Local\\ZX2C4IM"<br />
#define FILE "client.exe"<br />
<br />
int APIENTRY _tWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nCmdShow)<br />
{<br />
if(_tcscmp(lpCmdLine,"clone"))<br />
{<br />
CreateMutex(NULL,TRUE,MUTEX_STRING);<br />
if(GetLastError()==ERROR_ALREADY_EXISTS)<br />
{<br />
SendMessage(FindWindow(NULL, WINDOW_TITLE), RegisterWindowMessage(INSTANCEMESSAGE), NULL, NULL);<br />
return 0;<br />
}<br />
}<br />
ShellExecute(NULL,NULL,FILE,lpCmdLine,NULL,SW_SHOW);<br />
return 0;<br />
}<br />
|
|
|
|
|
I've only seen one article on the Internet that explained how to run a program from memory (rather than from disk). Unfortunately I do not have the URL, nor do I remember what I searched for to find it.
For what reason(s) are you against running the program from disk? While I've never compared the two verbatim, I think that running from disk requires far less code than the other method.
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
Can you help me find it? I'm desperate.
|
|
|
|
|
I would like to convert members in a CStringArray to char[49]. What would be the best way to do this. I tried strncpy (with getting the length of the CStringArray member, but this didnt seem to work).
Thank you.
Rihannsu
|
|
|
|