|
psychedelic_fur wrote: How do I make VC++ to automatically take the relative path of the file.
First it has nothing to do with Visual C++. You are using a library called STL to open the file. It uses the OS support to open the file and they both support relative paths. But just like an absolute path you have to get the relative path correct or it won't work.
led mike
|
|
|
|
|
You have to configure your IDE to use d:\testdata\debug as working directory when debugging. On Visual Studio 2005, for instance, select Project->Properties menu item and then (on the newly appeared window) select the Configuration Properties->Debugging node, select Working Directory item (on the Local Windows Debugger ) list and finally assign it the d:\testdata\debug path.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
|
|
|
|
|
|
psychedelic_fur wrote: Thank you
You're welcome.
psychedelic_fur wrote: It could probably be that MFC is setting the working directory automatically.
I don't think so.
Anyway now it works, why bother?
Best wishes.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
|
|
|
|
|
Hello All
Previously i have posted this message to wrong forum.
I am Developing ATL Project in which i have added ATL Dialog.
Now on this Dialog i want to add ShockwaveFlash Activex Control.
I am able to add this control but Problem is that i can not add Variable to this Control.
So is there anybody who can solve my problem?
Any help will be appriciated
Thanks in advance
Manish Patel.
B.E. - Information Technology.
|
|
|
|
|
|
Thanks for your reply
I got it
Manish Patel.
B.E. - Information Technology.
|
|
|
|
|
I wrote an ActiveX control. At first there was no GDI+ code in it and it worked well. Then I added follow code:
class ATL_NO_VTABLE MyControl:
public .........
{
...
BOOL OpenImageFile(BSTR FilePath) // added a method
{
USES_CONVERSION;
m_pBitmap = Bitmap::FromFile(FilePath);
return m_pBitmap!=NULL;
}
Bitmap *m_pBitmap; // added a point
}
After I added a point and a method, MyControl was no long created successfully. I searched in www.codeproject.com and finded Ryan Johnston's article----http://www.codeproject.com/KB/GDI-plus/gdipluscontrol.aspx, I read the article and thought it would resolve my problem, en..., it didn't.
It's very strange that after I remove my method, MyControl can be created, but if I add "static InitGDIPlus GDI_Plus_Controler;" in MyControl.cpp, MyControl can not be created again. I have not call the object's method yet, only declare a static global. Why this declaration make MyControl create failed?
I hope someone can help me resolving this problem. Suggestion, article, code example, anything may be helpful is appreciated, thank you.
My System: Windows 2000 Server, VC6(ATL3.0), Windows Server 2003 SP1 SDK
modified on Tuesday, March 18, 2008 11:06 AM
|
|
|
|
|
I change the system to windows 2003, the problem was resolved.
|
|
|
|
|
Sounds like you're missing gdiplus.dll. That didn't come with Win 2K.
|
|
|
|
|
We have two EXE. one COM EXE.
when calling some methods written in COM EXE, shows the following message.
What is the exact problem?
" This action cannot be completed because the other program is busy.
Choose 'Switch To' to activate the busy program and correct the problem"
|
|
|
|
|
Many things can cause this...
1. Your COM server or Main thread died
2. Main thread is processing a long operation
God bless,
Ernest Laurentin
|
|
|
|
|
Hello,
I am naive to Windows Services.
I have few queries regarding Windows Services which are as follows: -
How to manage User account?
For example there are several users present on a single machine and how to restrict users group from accessing the Windows Service?
Can do it using CoInitializeSecutriy(), if yes then How?
Thanks in Advance.
|
|
|
|
|
tony_udz wrote: How to manage User account?
tony_udz wrote: Can do it using CoInitializeSecutriy()
The obvious answer is to use the Windows User Management tool. If you want to develop your own software to do that it is going to be far more complicated that using a couple of API calls. If you want to do Windows Security development I suggest you find a good book that covers that topic in depth.
led mike
|
|
|
|
|
Hey Led,
Yes i am looking for Windows Security Management.
Can you please tell me the name of that book?
Thanks!
|
|
|
|
|
Never read one myself. If I wanted to find one I would start here[^]
led mike
|
|
|
|
|
Hello Friends,
I have developed one ATL com dll for IE tool bar.
My Ie toolbar is having buttons which i have created dynamically.
buttons are having Icon images also.
but i am facing one problem...
I can show only the Icon with "Bit Depth=8" of .ico image.
Actually i want to show Icons with "Bit Depth=32" also.
I am using below code..
UINT colormap = LR_DEFAULTSIZE |LR_LOADMAP3DCOLORS| LR_LOADFROMFILE | LR_CREATEDIBSECTION|LR_LOADTRANSPARENT;
HBITMAP hBitmap =(HBITMAP) ::LoadImage ((HINSTANCE)::GetModuleHandle(NULL),ImagePath,IMAGE_BITMAP,0,0,colormap);
In above code...
while Debugging i came to know that i am getting null in hBitmap variable for Icons with "Bit Depth=32". for Bit Depth up to 24 it is working fine.
Please suggest me the solution....
modified on Monday, March 10, 2008 2:06 AM
|
|
|
|
|
Why are you using IMAGE_BITMAP if you're trying to load icons?
You should try IMAGE_ICON.
Hope it helps
rotter
The metaller programmer
|
|
|
|
|
Thanks for reply ...
Yes i am now using IMAGE_ICON.
it is workin fine...now I can add Icon with 32 bit Depth in my image list.
I observed one more thing that IMAGE_BITMAP works for icons also...but for icons with Bit Depth upto 24 only.
Thank you...
|
|
|
|
|
Hi Friends,
I am using VC++ 6.0 I careated an exe server using ATL. It has one interface mdethod "ComputerName". Prototype of method is :
[id(1), helpstring("ComputerName")] HRESULT ComputerName([out] short *pnSize, [out, size_is(1, *pnSize)] unsigned char **ppszComputerName);
Server implementation of this function is :
STDMETHODIMP CTestServer::ComputerName(short *pnSize, unsigned char **ppszComputerName)
{
TCHAR szBuffer[100] = {0};
DWORD dwSize = 0;
int iLength = 0;
dwSize = sizeof(szBuffer);
GetComputerName(szBuffer, &dwSize);
iLength = ::lstrlen(szBuffer);
*pnSize = iLength;
*ppszComputerName = (unsigned char *) CoTaskMemAlloc(iLength + 1);
::lstrcpy((char *) *ppszComputerName, szBuffer);
return(S_OK);
}
Client Side Implementation is :
ITestServer *pITestServer = NULL;
HRESULT hResult = NULL;
short int nSize = 0;
unsigned char *pszComputerName = NULL;
CoInitialize(NULL);
hResult = CoCreateInstance(....);
if(SUCCEEDED(hResult))
{
pITestServer->ComputerName(&nSize, &pszComputerName);
// Here is problem only pszComputerName[0] contains valid data. other contains invalid data. nSize contains valid length.
pITestServer->Release();
}
CoUninitialize();
I am unable to get the reason. Anyone can help me please.
Manish Rastogi
|
|
|
|
|
Hi Manish,
If you want to pass string, use BSTR. COM marshalling works a bit different.
If you plan to transfer 'byte*', use Safearray of byte.
God bless,
Ernest Laurentin
|
|
|
|
|
Thanks Ernest Laurentin
BSTR is working.
|
|
|
|
|
Hi All,
I have an ActiveX control. And the event map is defined in the control's implementation (.CPP) file.
Say the event map has a function
EVENT_CUSTOM("SomeEvent", FireSomeEvent, VTS_BOOL)
defined in it...
Now I can very easily call the function 'FireSomeEvent' from the control's implementation cpp file.
Can I call 'FireSomeEvent' from some other cpp file....means some other's class's code ??
If yes then how??
Urgent help needed...
Thanks and Regards
...A Programmer may or may not be the master of the programming language grammar...
|
|
|
|
|
//Main.h
__interface IFileIO : IDispatch
{
[id(1), helpstring("method GetFile")] HRESULT GetFile();
[id(2), helpstring("method getDirectory")] HRESULT GetDirectory();
};
class ATL_NO_VTABLE EDCService :public IFileIO
{
public:
EDCService()
{
}
DECLARE_PROTECT_FINAL_CONSTRUCT()
HRESULT FinalConstruct()
{
return S_OK;
}
void FinalRelease()
{
}
public:
STDMETHOD(GetFile);
STDMETHOD(GetDirectory);
}
Hi friends ...
STDMETHOD(GetFile);
STDMETHOD(GetDirectory); these two methods definitions are written main.cpp
i doing so many try's to solve this prob..first i create instance of EDCService.like
EDCService edcobj;
then i create instance of EDCService like
edcobj.CreateInstance(); but showing..
When i compile this code i get the follwing errors i dont know how was solve it
error C2039: 'CreateInstance' : is not a member of 'EDCService'
error C2259: 'EDCService' : cannot instantiate abstract class
Please tell me how to solve this problem ..
|
|
|
|
|
Sakthi_Vel wrote: then i create instance of EDCService like
edcobj.CreateInstance(); but showing..
When i compile this code i get the follwing errors i dont know how was solve it
error C2039: 'CreateInstance' : is not a member of 'EDCService'
You aren't supposed to create an instance that way. If you are inside your program, you could use CComObject<edcservice>::CreateInstance. To create it from a client, you would normally assign a class ID to EDCService and the use CoCreateInstance.
Sakthi_Vel wrote: error C2259: 'EDCService' : cannot instantiate abstract class
IDispatch has four pure virtual methods that you can implement by deriving EDCService from IDispatchImpl. IDispatch derives from IUnknown which has three more methods, which are implemented in CComObject. Also you need an interface map for EDCService so that CComObject::QueryInterface can work correctly.
Sakthi_Vel wrote: //Main.h
__interface IFileIO : IDispatch
{
[id(1), helpstring("method GetFile")] HRESULT GetFile();
[id(2), helpstring("method getDirectory")] HRESULT GetDirectory();
};
This looks like attributed ATL. You really don't want to use it. Attribute support for standard C++ is much weaker than for .net, and I've found that (at least with VS2003) that it has an extreme problem with interface dependancies, because the generated .idl file neither forward declares types, nor attempts to put them in an order which wouldn't need it. To do anything significant with ATL, you'll need to learn IDL.
Nathan
|
|
|
|