mfc ext dll from path

(vc++6 sp5)

Is there any way to speciafy a certain path for the dll?
I dont load it with LoadLibraray() and it is assumed to be in the same
directory the application resists or in some common dll-hells, but i
want it to be in a subdir of my app.

where do i specify the path?


thx, .rhavin;)

0
clqrq (258)
8/27/2007 3:28:14 PM
vc.mfc 33608 articles. 0 followers. Follow

10 Replies
585 Views

Similar Articles

[PageSpeed] 3

On Aug 27, 11:28 am, ".rhavin grobert" <cl...@yahoo.de> wrote:
> (vc++6 sp5)
>
> Is there any way to speciafy a certain path for the dll?
> I dont load it with LoadLibraray() and it is assumed to be in the same
> directory the application resists or in some common dll-hells, but i
> want it to be in a subdir of my app.
>
> where do i specify the path?
>
> thx, .rhavin;)


Have you tried specfiying the path relative to current path?

---
Ajay

0
ajaykalra (6842)
8/27/2007 3:33:08 PM
On 27 Aug., 17:33, Ajay Kalra <ajayka...@yahoo.com> wrote:
> On Aug 27, 11:28 am, ".rhavin grobert" <cl...@yahoo.de> wrote:

> > where do i specify the path?
> Have you tried specfiying the path relative to current path?

*where* ?

under 'settings' i can set the path to the *.lib-file, but i can see
no setting for dll-path.

0
clqrq (258)
8/27/2007 3:41:21 PM
I have never tried this but it might work.  Specifing the application/dll 
path in the registery.

http://www.codeguru.com/Cpp/W-P/dll/article.php/c99

AliR.


".rhavin grobert" <clqrq@yahoo.de> wrote in message 
news:1188228494.287929.122060@d55g2000hsg.googlegroups.com...
> (vc++6 sp5)
>
> Is there any way to speciafy a certain path for the dll?
> I dont load it with LoadLibraray() and it is assumed to be in the same
> directory the application resists or in some common dll-hells, but i
> want it to be in a subdir of my app.
>
> where do i specify the path?
>
>
> thx, .rhavin;)
> 


0
AliR3470 (3236)
8/27/2007 3:42:05 PM
On Aug 27, 11:41 am, ".rhavin grobert" <cl...@yahoo.de> wrote:
> On 27 Aug., 17:33, Ajay Kalra <ajayka...@yahoo.com> wrote:
>
> > On Aug 27, 11:28 am, ".rhavin grobert" <cl...@yahoo.de> wrote:
> > > where do i specify the path?
> > Have you tried specfiying the path relative to current path?
>
> *where* ?
>
> under 'settings' i can set the path to the *.lib-file, but i can see
> no setting for dll-path.


I meant in the code. Changing the path the way you are suggesting it
would only work if you launch it from within IDE.

---
Ajay

0
ajaykalra (6842)
8/27/2007 3:42:57 PM
He is linking to a .lib file, he is not loading the dll dynamically.

AliR.


"Ajay Kalra" <ajaykalra@yahoo.com> wrote in message 
news:1188229377.782730.302520@22g2000hsm.googlegroups.com...
> On Aug 27, 11:41 am, ".rhavin grobert" <cl...@yahoo.de> wrote:
>> On 27 Aug., 17:33, Ajay Kalra <ajayka...@yahoo.com> wrote:
>>
>> > On Aug 27, 11:28 am, ".rhavin grobert" <cl...@yahoo.de> wrote:
>> > > where do i specify the path?
>> > Have you tried specfiying the path relative to current path?
>>
>> *where* ?
>>
>> under 'settings' i can set the path to the *.lib-file, but i can see
>> no setting for dll-path.
>
>
> I meant in the code. Changing the path the way you are suggesting it
> would only work if you launch it from within IDE.
>
> ---
> Ajay
> 


0
AliR3470 (3236)
8/27/2007 3:43:25 PM
On 27 Aug., 17:42, "AliR \(VC++ MVP\)" <A...@online.nospam> wrote:
> I have never tried this but it might work.  Specifing the application/dll
> path in the registery.
>
> http://www.codeguru.com/Cpp/W-P/dll/article.php/c99

that one really has a sour taste;-\ i'd like to leave the registry
untouched by all of my programms exept for adding filetypes. isn't
there a straitforward way to say: "you find foo.dll at './subdir/
foo.dll' ", relative to the current path?

that way, anyone could put my app in a directory he wants and just has
to provide the subdirectory-structure as is. you could even move the
app-folder after installation to $whereever and still it would run
fine...

0
clqrq (258)
8/27/2007 4:03:36 PM
Like the article said this is the order in which the OS looks for a dll that 
your app is trying to load. You can always give #6 a try (add your dll's 
path to the PATH variable)

  1.. The directories listed in the App Path registry key
  2.. The directory where the executable module for the current process is 
located.
  3.. The current directory.
  4.. The Windows system directory. The GetSystemDirectory function 
retrieves the path of this directory.
  5.. The Windows directory. The GetWindowsDirectory function retrieves the 
path of this directory.
  6.. The directories listed in the PATH environment variable.
AliR.


".rhavin grobert" <clqrq@yahoo.de> wrote in message 
news:1188230616.276786.129920@k79g2000hse.googlegroups.com...
> On 27 Aug., 17:42, "AliR \(VC++ MVP\)" <A...@online.nospam> wrote:
>> I have never tried this but it might work.  Specifing the application/dll
>> path in the registery.
>>
>> http://www.codeguru.com/Cpp/W-P/dll/article.php/c99
>
> that one really has a sour taste;-\ i'd like to leave the registry
> untouched by all of my programms exept for adding filetypes. isn't
> there a straitforward way to say: "you find foo.dll at './subdir/
> foo.dll' ", relative to the current path?
>
> that way, anyone could put my app in a directory he wants and just has
> to provide the subdirectory-structure as is. you could even move the
> app-folder after installation to $whereever and still it would run
> fine...
> 


0
AliR3470 (3236)
8/27/2007 4:11:32 PM
There are several problems with using PATH.  The most important one is that you open
yourself to intractable tech support problems.  (Until you've spent 5 hours on the phone
to Sweden trying to get PATHs straightened out, to an important customer who had never
heard of paths, did not speak very good English--but was better than my nonexistent
Swedish--who was using an editor I was unfamiliar with, and who ultimately had a problem
that could not be solved with PATH, since there were two conflicting situations).

Since you want to put it in a subdirectory, look into the issues of DLL Redirection,
including putting your DLLs for program.exe in a subdirectory called program.exe.local.  

Also, manifests are supposed to deal with some of these issues, except I've never found
any documentation on manifests.

But for your continued sanity, and to reduce tech support costs, never use or depend on
putting your own directories in PATH.  
					joe

On Mon, 27 Aug 2007 08:28:14 -0700, ".rhavin grobert" <clqrq@yahoo.de> wrote:

>(vc++6 sp5)
>
>Is there any way to speciafy a certain path for the dll?
>I dont load it with LoadLibraray() and it is assumed to be in the same
>directory the application resists or in some common dll-hells, but i
>want it to be in a subdir of my app.
>
>where do i specify the path?
>
>
>thx, .rhavin;)
Joseph M. Newcomer [MVP]
email: newcomer@flounder.com
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
0
newcomer (15975)
8/27/2007 5:35:51 PM
On Aug 27, 12:03 pm, ".rhavin grobert" <cl...@yahoo.de> wrote:
> On 27 Aug., 17:42, "AliR \(VC++ MVP\)" <A...@online.nospam> wrote:
>
> > I have never tried this but it might work.  Specifing the application/dll
> > path in the registery.
>
> >http://www.codeguru.com/Cpp/W-P/dll/article.php/c99
>
> that one really has a sour taste;-\ i'd like to leave the registry
> untouched by all of my programms exept for adding filetypes. isn't
> there a straitforward way to say: "you find foo.dll at './subdir/
> foo.dll' ", relative to the current path?
>
> that way, anyone could put my app in a directory he wants and just has
> to provide the subdirectory-structure as is. you could even move the
> app-folder after installation to $whereever and still it would run
> fine...

I woudlnt touch registry for this as well. We had tons of DLLs and put
all those in the same directory; same as the executable. That works
well and unless you have a solid reason not to do so, I would lean in
that direction.

---
Ajay



0
ajaykalra (6842)
8/27/2007 6:59:23 PM
On 27 Aug., 20:59, Ajay Kalra <ajayka...@yahoo.com> wrote:
> I woudlnt touch registry for this as well. We had tons of DLLs and put
> all those in the same directory; same as the executable. That works
> well and unless you have a solid reason not to do so, I would lean in
> that direction.

the only reason is aestetics ... i write programs for people asking
questions like...

They:   "why did my program vanish?"
Me:   "What did you do?"
They:   "I just clicked in the small x in the upper right corner and
then came a box i did not read but managed to get away by clicking to
'OK'...so where is my program?"
(they cant read usenet i hope *g*)

0
clqrq (258)
8/28/2007 2:31:50 PM
Reply:

Similar Artilces:

DLL Doesn't Work
I'm writing some program extensions using DLLs that are renamed to have a different extension. (The DLLs do not use MFC or ATL.) I have this working fine. But when, instead of having VC create the basic files for me, I instead click 'Empty project' and then add my files, the resulting DLL does not appear to be correct. For starters, the resulting file is only about 50KB. Second, although LoadLibrary does not return NULL, my DllMain routine never gets called. I've selected DLL as the project type. I added the DEF file to the project, added the DEF file to the appropriate entr...

MFC client server application
hi experts In case where CSocket is used as the communication mechanism between the server & the client , the OnReceive() overridable notification function gets called when ever server receives data from client. But when i use winsock2 where do i place thr recv() in the server side. Since server is a dialog based MFC app, i give the following code in the OnInitDialog(): SOCKET server; WSADATA wsaData; sockaddr_in local; WORD wVersionRequested = MAKEWORD(2,2); int wsaret = WSAStartup(wVersionRequested, &wsaData); if(wsaret != 0) AfxMessageBox(_T("WSAStartup() failed...

Accessing global variables in EXE from DLL
Is there any way I can access the global variables declared in the EXE file from a DLL? Thank you Abhijit No. And it would be a truly lousy idea to try to do so. The word "Modularization" comes to mind. You could pass pointers to these variables in, but frankly, it strikes me as exceptionally poor practice to do so. If the DLL needs state, the state should come in via a pointer to some class that defines the DLL context. The usual reason for this question, by the way, is most often trying to partition poorly-written code into a DLL, where the poorly-written code uses global varia...

[MFC
Hi, Normally I shoult not post here because my problem is specific to wince platforms but I am a bit in a hurry and this newsgroup has more readers. I am trying for two days to write an application able to switch bewteens views and to display a new command bar(this part is wince specific). As long as I try only to switch bewteen view, everything works fine but when I try to modify the Command bar I get an assert in wincore.cpp L 442. I have already posted to MSDN forums but with no success. So maybe a MFC guru with a pocket pc experience could have a look ... To reproduce my issue I hav...

How to get the dll module name?
My dll project will generate a Data.dll. In my dll project, how to get the module name, namely, the "Data.dll"? I try to use "GetModuleHandle", but it give me the exe module name, not the dll module name. char Buffer[255]; GetModuleFileName((HMODULE)AfxGetInstanceHandle(),Buffer,255); AliR. "kathy" <yqin_99@yahoo.com> wrote in message news:1144681490.715787.66900@t31g2000cwb.googlegroups.com... > My dll project will generate a Data.dll. In my dll project, how to get > the module name, namely, the "Data.dll"? > > I try to use &qu...

DLL global variable
If I have global variable in my dll, will it hold same information for all Apps that use that DLL in the same time, or every app will have own instance? TIA > If I have global variable in my dll, will it hold same information for >all Apps that use that DLL in the same time, or every app will have own >instance? Jan, Unless you specifically declare a shared variable (by placing it in a shared data segment), each process that uses your DLL will have its own instance. Dave -- MVP VC++ FAQ: http://www.mvps.org/vcfaq > Unless you specifically declare a shared variable ...

MFC Resource Language Translation?
Hi All, I need translate my MFC application into a variety of different languages. The problem is my app has a lot of different dialogs all of which are heavily text labelled. Is there anyway to export all of the text in the app to a RTF file? Any suggestion gratefully received! Kind Regards Andrew I don't know about RTF, but my Polish translator swears by WordTrans (http://www.wordtrans.co.uk/content/home.asp) whereas my Spanish/Portuguese translators use Catalyst (http://www.alchemysoftware.ie/). From my point of view, the latter translates the resource DLL files, so everything ...

How I can get a missing file "SHLWAPI.dll"
I have dawn loaded the new explorer 8 at the installation a flag appers to tel me that the instalation can't be completed for the reason that the file SHLWAPI.dll was missing. What can I do?. Johnang, You need to repost your issue here... (and you probably want to mention which version of Windows you're on.) http://social.answers.microsoft.com/Forums/en-US/InternetExplorer/threads This forum is for Microsoft Access a database software. -- Gina Whipp 2010 Microsoft MVP (Access) "I feel I have been denied critical, need to know, information!" - Tremo...

Question on "rollover" type buttons (mfc/activex)
I've got a dialog box with an active-x toolbar. I'd like to have the type of buttons that have simply a bitmap with no border. When the mouse moves over the bitmap, the bitmap changes into a "selected" version of the bitmap. This is just like a "hover" button in html now that I think of it.. Also, are there any good books out there on developing these types of controls? Thanks, ~billy A simple owner-draw button that notices OnMouseEnter/OnMouseLeave events. joe On Mon, 10 May 2004 19:36:31 -0700, "billy" <billy_dev#@#cox#.#net> wrote: &g...

Sharepoint.dll error
On a 10.0 client install w/SP2, when launching GP, I am getting "Microsoft.Dynamics.GP.Sharepoint.dll Form Business_Desk_Sharepoint_Interop does not exist in the dictionary. Parameter Name: formname. To install, I uninstalled .net 3.0 sp1 and .net 2.0 sp1. I added the 2.0 sp1 back in. What is causing this error, Business Portal/Sharepoint is not installed. ...

returning the path of a linked table in VBA
Is there any way to capture the path of a linked table (say, tblContacts) in VBA? Thanks in advance, Paul "Paul" <BegoneSpam@forever.com> wrote in message news:OiW7FV4qKHA.4752@TK2MSFTNGP04.phx.gbl... > Is there any way to capture the path of a linked table (say, tblContacts) > in VBA? Parse it from the Connect property of the TableDef, e.g.: CurrentDb.TableDefs("tblContacts").Connect -- Allen Browne - Microsoft MVP. Perth, Western Australia Tips for Access users - http://allenbrowne.com/tips.html Reply to group, rather than ...

Export to Excel from MFC program
Hi all, I have an Excel import function working for an MFC application but now wish to get an export-to-Excel function working as well. My code is posted below. After creating a blank spreadsheet, and running the function, I get error message "database engine could not find the object InputSet", from the CRecordSet "Open()" function. "InputSet" is the name of the database defined when the project was started, and resides in GetDefaultSQL(). Any ideas ? Gerry ================================================== void CGPI5Doc::OnNamesExport() { // TODO: Add you...

How to change startup form in vc++ MFC
hi friends, can anyone tell me how i can change form which starts first in vc++ mfc, actuallly i am inserting a form but whenever i run a program it will start default form and i need to run my form which i have inserted.... hardik wrote: > hi friends, > can anyone tell me how i can change form which starts > first in vc++ mfc, > actuallly i am inserting a form but whenever i run a program it will > start default form and i need > to run my form which i have inserted.... Is this a dialog based application? If so, the initial form is determ...

Create a Activex Dll in VC++6.0
Hi, I had create a ocx to view some images in vc++ 6.0 when used that ocx in Internet explorer it takes time to display the image. I came to know that Activex dll will be faster that the Activex ocx ,any one can say how to create a Activex dll in vc++ 6.0 http://groups.google.co.in/group/comp.lang.basic.visual.misc/browse_thread/thread/d2afa1e7b3e984ab/316ea6591a90a495?q=difference+between+dll+and+ocx&rnum=5&hl=en#316ea6591a90a495 Thanks in advance Hi No differance between .ocx & .dll. For ActiveX controls the name 'dll' is turned into 'ocx', but they are...

How to insure that MFC debug dll is unloaded last?
I have a problem related to order of dll unloading. (VC 6.0) My application uses MFC (as a shared dll) and another (non MFC) dll, which exports some data. DEBUG version of application exits MFC debug dll is unloaded first and as a result reports memory leaks for another dll static objects which allocated memory for theirs members. These objects are deleted later when mention dll is unloaded, so in reality there is no any leaks, but debuging is really painful. So I tried to solve the problem, but have not found ANY solution. DELAY load compiler option does not work for any of the mentioned ...

sound path from itunes
I downloaded a song from itunes and when I try to embed it in the ppt an error box comes up and says that the path can't be found. I checked other songs and get the same thing. A song I bought from another site worked. Please help me my presentation is next week. Thanks, Leanne Leanne, Is your song in the MP3 format? Is it in the same FOLDER as your presentation? Maybe your total folder length is toooo long see See point 2 http://www.echosvoice.com/tshoot_video2.htm cheers TAJ Simmons PowerPoint Master http://www.awesomebackgrounds.com awesome - powerpoint ...

How to create CDialog from different DLL?
Hello, I’m trying to create a CDialog object, which is defined in one DLL from a class in another DLL. The dialog appears to be successfully created but its handle is invalid, when I’m trying to use "this" the application crashes with a debug assertion at wincore.cpp "LookupPermanent". Do you have any suggestion how to solve this problem? Thanks, Limor If it was successfully created, you would have a valid handle of the dialog. I suspect that it was not created successfully because the resource for the dialog was not found. What type of DLL are you using. If its an...

MFC/VC/ATL/STL Goldmine has been updated: http://preciseinfo.org/Convert/index_Convert_mfc.html
Good news: Site search has been fully implemented. You can search the entire site or collection or a single chapter related to specific context to find what you are looking for. Bad news: We are currently out of sync with google. So, if you do a google search you might see a different article than what google shows. So, it is suggested to search the site instead. First of all it is a much more powerful search than what you can do with Google. Plus you are going to see the right thing. MFC Goldmine collection contains the extensive collection of articles going back several y...

MFC Dlls #2
Hi I was written an MFC EX. DLL and use in MFC App - it's working OK, But when I want to use it in C# ( C Style export ) it crash. Why? Thanks Koby Because it is an MFC Extension DLL. This makes a lot of assumptions about the environment in which it is running, which would not be true in a C# environment. Converting it to a conventional (non-extension) DLL should solve the problem. joe On Sat, 17 Jan 2004 11:54:55 -0800, "Koby" <anonymous@discussions.microsoft.com> wrote: >Hi >I was written an MFC EX. DLL and use in MFC App - it's >working OK, >...

Windows cannot access the specified device, path or file...
My buddy sent me a little file, 1.25mb, and I cannot open it. He can but I cannot. I get "Windows cannot access the specified device, path or file. You may not have the approiate permissions to access the item". XP Pro. Retail version. Have disk. This is my home computer. No administrator rights needed. No password needed. I'm the only one in the house. Computer in my name. No other users. What's up. Joe T. wrote: > My buddy sent me a little file, 1.25mb, and I cannot open it. He > can but I cannot. I get "Windows cannot access the specified > de...

getting rid of the standard mfc icon (in taskbar)
i made an application based on mfc, and used the standard mfc icon up until now. i thought changing it would be a simple task. in the resource editor i got rid of all mfc icons in various resolutions, and replaced it with my own icon in 3 different resolutions. it does work in almost all the places: the main window is shown with the correct icon, the taskbar shows correctly with the icon, even MessageBox() shows the icon now, but as soon as i do open a MessageBox while my main-window is shown, the counter in taskbar moves up to two (you know how windows xp groups together tasks with th...

CAsyncSocket()::OnReceive() will not be fired !!! -> MFC BUG ?!?
Hello peoples i have wrotten a FTP-Client with a own Class of CAsyncSocket. Sometime the messagge from the Server will NOT BE reveiced, but the server have ben sendet to the Client ( the OnReceive() of the Client is not called !!) I use MSVS6.0 OR can´t use the CAsyncSocket for a FTP-Client ? ( the CInternetConnetion can´t use, why i need ALL sended and received data for displaying regard Nico van Halobar Nico van Halobard wrote: > Hello peoples, > > i have wrotten a FTP-Client with a own Class of CAsyncSocket. Sometime the messagge from the Server will NOT BE revei...

Path changing in formula when workbook in different folder
Hi , I have a workbook that references another workbook via a cell formula: ='C:\Folder\[Workbook.xls]Sheet Name'!$M$7+F7 It is to calculate a cumulative year to date total from monthly accounts. I have noticed that it now changed the path if I copy the sheet to a subfolder and open it. For example if I copy the book to C:/Folder/Subfolder then open it, all the formula have automatically updated to ='C:\Folder\Subfoldr\[Workbook.xls]Sheet Name'!$M$7+F7 Why should it just start doing this today ? How do I prevent it ? Thanks , hals_left ...

file association using MFC
Hi there: I am in the process of leaning VC++ MFC. I have written a program wthat will display the complete path for the selected file name from open dialog box. Now I would like to associate my program to a file type.. lets say .jpeg files. When I double click on any .jpeg files I would like to have may program open and display the complete path. I know it has to do something with DDE. Can somebody point me to the right direction. Thanks for your help Biju Here is the code void CChildView::OnFileOpen() { static char BASED_CODE szFilter[] = "Image Files (*.jpeg, *.jpg, *....

Running a .bat file with spaces in the path.
I am trying to run a .bat file from a macro. The shell command works okay most of the time - but I cannot seem to make it work if there is a space in the path. (So, running C:\Apps\BFIle.bat works, but not C:\My Apps\BFile.bat) As the .bat file I want to run will change, I want to enter the path in a cell, and then run the macro with a button. This means simply enteing the path in double quotation marks in the Shell command will not work. BFile = Range("A2").Value i = Shell (BFile, 1) Any ideas? Odd that a space is giving you a problem. This works for me whether the path has a ...