|
Hello,
How to show certificate in WebBrowser Control..
Thanks..
|
|
|
|
|
hello friends
I want to open a new instance of program on the double click of an Icon in windows.I tried with some code but they r using SetExtension,setdocumentshellopencommand and regsetallinfo.
It seems to b working but I want to know that do i need to register everytime to the registery for the double click event.Or cant I register only once in registery for setExtension and then for double click.
The main Prob is i want to know how it is executing when i Double click on Icon and I dont want to register everytime.
Thanks & Regards
Yogesh
|
|
|
|
|
yogeshs wrote: I want to open a new instance of program on the double click of an Icon in windows.
So what's the problem? This is the default behavior. Only if you wanted a single instance to exist would you need to add any code.
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
i need a tool for windows that can work like that:
replace all file (found) with an extension by the others,
name of that new file was not changed but its empty(does not have any infomation anymore).
please help me
sorry for everthing
|
|
|
|
|
What do you mean by replace?
Do you want to delete it or rename it?
You can do both using SHFileOperation[^].
«_Superman_»
I love work. It gives me something to do between weekends.
|
|
|
|
|
I too don't understand for sure, but if you simply want to change the extension (rename the files) to a new extension, you can simply use the old DOS rename command.
rename *.xyz *.abc
Hope that helps.
Karl - WK5M
PP-ASEL-IA (N43CS)
PGP Key: 0xDB02E193
PGP Key Fingerprint: 8F06 5A2E 2735 892B 821C 871A 0411 94EA DB02 E193
|
|
|
|
|
No. example. file abc.xyz being replaced by new abc.xyz (the same name) (but this file is empty, no information inside)
|
|
|
|
|
So you want to keep the file but simply delete it's contents?
If so, open the file for writing and then close the file. As long as you don't specify "no truncate", this should delete all of the file contents.
Good luck.
Karl - WK5M
PP-ASEL-IA (N43CS)
PGP Key: 0xDB02E193
PGP Key Fingerprint: 8F06 5A2E 2735 892B 821C 871A 0411 94EA DB02 E193
|
|
|
|
|
animal123 wrote: sorry for everthing
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
Universal, preventative measure.
|
|
|
|
|
I have a lib and its corresponding header file in C or C++ that I want to use it in Visual C++.net. The header file has a structure like this:
Reader.h:
class AFX_EXT_CLASS Reader
{
.
.
.
};
extern "C" AFX_EXT_API Reader * CreateReader();
There is no problem using the class but I can't use the CreateReader() function. There are 2 linkage errors: LNK2028, LNK2019.
Can you help me using this function please?
Thanks in advance
|
|
|
|
|
Its probably because the calling conventions used where the function is declared and where the function is used are different.
How is AFX_EXT_API defined?
If it is defined as __declspec(dllexport) , make it __stdcall __declspec(dllexport)
Or rather, simply make it
extern "C" AFX_EXT_API Reader* __stdcall CreateReader();
«_Superman_»
I love work. It gives me something to do between weekends.
modified on Tuesday, August 18, 2009 5:57 AM
|
|
|
|
|
I don't have any access to the lib file. I only use it. You mean I only change it in the header file?! Is it possible? Besides there is no __declspec(dllexport). It is declared exactly as I wrote:
extern "C" AFX_EXT_API Reader* CreateReader();
Besides I use it with /clr. Thanks
modified on Tuesday, August 18, 2009 6:08 AM
|
|
|
|
|
It is not enough to simply change it in the header file, unless you know which calling convention was used.
You can try and use different calling conventions like __cdecl and __stdcall .
«_Superman_»
I love work. It gives me something to do between weekends.
|
|
|
|
|
You mean when I want to call it, for example in one function in my own application I use "__cdecl" before calling? like this?:
Reader* m_pReader=__cdecl CreateReader();
|
|
|
|
|
No. I mean in the header file.
«_Superman_»
I love work. It gives me something to do between weekends.
|
|
|
|
|
I change the header file
from:
extern "C" AFX_EXT_API Reader * CreateReader();
to:
extern "C" AFX_EXT_API Reader * __stdcall CreateReader();
and also:
extern "C" AFX_EXT_API Reader * __cdecl CreateReader();
but it doesn't work.The same errors occur. Should I do anything while calling the function? I include the header file and call the function as a usual ones.
modified on Tuesday, August 18, 2009 7:04 AM
|
|
|
|
|
Did ya read the msdn for the errors?
http://msdn.microsoft.com/en-us/library/799kze2z%28VS.80%29.aspx
I guess your CreateReader() implementation is missing or falsly decorated.
A Hint: I hope you are not creating objects in the dll and try to destroy it in the app. This can leads to strange errors. Such interfaces are better "native" as integer or LPCSTR pointers!!! It is hard to tell
Press F1 for help or google it.
Greetings from Germany
|
|
|
|
|
I finally could solve the problem by changing "\properties\linker\input\Additional Dependences\".
It compiles well and there is no linkage error anymore but I get another error while running the project:
"The specified module could not be found (Exception from HRESULT:0x8007007E)"
The error happens in Application.Run in program.cs, but not at the time of loading the form, but it happens when I want to make an object from my class, even when I don't use that specific function. Besides my dll is in Visual C++.Net and I'm calling it from C#.Net.
Could you please help me?
Thanks in advance
|
|
|
|
|
some COM-Error are a pain -most- if they arent documented by MS
i found after googling: http://msdn.microsoft.com/en-us/library/e74a18c4%28VS.71%29.aspx
you should narrow to the problem, maybe your COM object GUID isnt properly registed or the instance cant be launched because missing dlls. Most common mixed debug and release builds.
Have a lot of fun ...
Press F1 for help or google it.
Greetings from Germany
|
|
|
|
|
Just wanted to know if there is a news server on Microsoft for Exchange server.
|
|
|
|
|
|
Hi all,
this is my first post on the Code Project forums, since I'm using one of the tool posted here, I thought I should ask where the knowledge lies in order to solve my problem
the problem
In my 3d engine, each texture creation reserves 3 times the space it should need in memory.
Hypotheses
- 3d engine based on Loulou's YesEngine (here, in French)
- Runs on Windows Mobile 6.1 with Direct 3d Mobile (D3D subset)
- Windows Mobile is much restrictive concerning virtual memory (32MB against desktop's 2GB), so the heap is full pretty fast.
1st step: texture creation
IRscTextureBase* GDirect3DMRenderer::CreateTexture(const TVector2I& Size, TPixelFormat Format, unsigned long Flags) const
{
bool HasMipmaps = (Flags & TEX_NOMIPMAP) != 0;
bool AutoMipmaps = false;
unsigned long Usage = m_SurfCaps_Texture;
LPDIRECT3DMOBILETEXTURE Texture = NULL;
HRESULT hr;
if ( FAILED ( hr = D3DMXCreateTexture(m_Device, Size.x, Size.y, 0, Usage, CD3DMEnum::Get(Format), m_SurfCaps_Pool, &Texture) ) )
throw CD3DMException(_T("D3DXCreateTexture"), _T("CreateTexture"));
return new CD3DMTexture(Size, Format, HasMipmaps, AutoMipmaps, Usage, Texture);
}
D3DMXCreateTexture reserves memory space (ok), but new CD3DMTexture (simple object to encapsulate my D3DM texture) does the same ! We exit the function with 2 spaces reserved in memory instead of one.
reference :
class CD3DMTexture : public IRscTextureBase
{
public :
CD3DMTexture(const TVector2I& Size, TPixelFormat Format, bool HasMipmaps, bool AutoMipmaps, unsigned long Usage, IDirect3DMobileTexture* Texture);
IDirect3DMobileTexture* GetDxTexture() const;
private :
virtual void Update(const CRectangle& Rect);
void UpdateSurface(const D3DMLOCKED_RECT& LockedRect, const CRectangle& Rect);
CSmartPtr<IDirect3DMobileTexture , CResourceCOM > m_Texture;
unsigned long m_Usage;
};
2d step : texture update
A lot of devices (let's say Omnia) don't allow texture locking, thus we're forced to use surface locking, and then copy pixels from one surface to another... as follows :
void CD3DMTexture::Update(const CRectangle& Rect)
{
Assert(CRectangle(0, 0, m_Size.x, m_Size.y).Intersects(Rect) == INT_IN);
if (m_Format == m_Data.GetFormat() && (m_Usage & D3DMUSAGE_LOCKABLE) )
{
D3DMLOCKED_RECT LockedRect;
RECT Lock = {Rect.Left(), Rect.Top(), Rect.Right(), Rect.Bottom()};
m_Texture->LockRect(0, &LockedRect, &Lock, 0);
UpdateSurface(LockedRect, Rect);
m_Texture->UnlockRect(0);
}
else
{
CSmartPtr<IDirect3DMobileDevice, CResourceCOM> Device;
m_Texture->GetDevice(&GetPtr(Device));
CSmartPtr<IDirect3DMobileSurface, CResourceCOM> Src;
HRESULT res = Device->CreateImageSurface(Rect.Width(), Rect.Height(), CD3DMEnum::Get(m_Data.GetFormat()), &GetPtr(Src));
if (FAILED(res))
{
throw CD3DMException(_T("CreateImageSurface"), _T("CD3DMTexture::Update"));
}
D3DMLOCKED_RECT LockedRect;
Src->LockRect(&LockedRect, NULL, 0);
UpdateSurface(LockedRect, Rect);
Src->UnlockRect();
CSmartPtr<IDirect3DMobileSurface, CResourceCOM> Dest;
m_Texture->GetSurfaceLevel(0, &GetPtr(Dest));
RECT DestRect = {Rect.Left(), Rect.Top(), Rect.Right(), Rect.Bottom()};
if (FAILED(D3DMXLoadSurfaceFromSurface(Dest, NULL, &DestRect, Src, NULL, NULL, D3DMX_DEFAULT, 0)))
throw CD3DMException(_T("D3DXLoadSurfaceFromSurface"), _T("CD3DMTexture::Update"));
m_Texture->GetSurfaceLevel(0, &GetPtr(Dest));
IDirect3DMobileSurface_Release(GetPtr(Dest));
}
}
Src surface reserves the space needed during CreateImageSurface, then free it when we exit the brackets where it's defined (thanks smart pointer).
However, Dest does also a reservation about the same size during D3DMXLoadSurfaceFromSurface... but doesn't release it when the smart pointer is freed !
Conclusion
We have 3 times the needed space reserved by a texture, that other components of the program won't be able to use. With 32MB of virtual memory, I guess you already figured how painful it may be !
There shall be some stuff I messed up, or maybe is it due to the implementation of the YesEngine (encapsulating the D3D texture for instance ?) creating some conflict with D3DM data types... anyway...
Help !
Thanks for your help, may you be WM developer or not (it's after all only a subset of Windows API and DirectX )
ps: see here for more information about the well named "WM virtual memory monster" (and thanks a lot to it's author)
http://www.codeproject.com/KB/mobile/VirtualMemory.aspx
modified on Tuesday, August 18, 2009 4:46 AM
|
|
|
|
|
Are you sure that it is reserved 3 times ? I would guess it is "only" two times:
When you create your texture and pass it to the CD3DMTexture constructor, the pointer will be passed to the the smart pointer, which doesn't make a copy of the pointed object. Thus, you do not duplicate the texture.
MMoi wrote: A lot of devices (let's say Omnia) don't allow texture locking, thus we're forced to use surface locking, and then copy pixels from one surface to another... as follows :
For that part, I can't really help: I never really worked with DirectX before.
|
|
|
|
|
First, thanks a lot Cedric for your quick answer
We agree, it should not reserve it again since I'm juste passing the pointer to a smart pointer. But... it does !
I tried using a simple pointer instead of a smart pointer in CD3DMTexture, but same result
Actually, as soon as I create a new CD3DMTexture instance anywhere in the CreateTexture function of my renderer (didn't try to do it in another place yet), there is a memory reservation the same size than the texture.
Could be also an glitch in the VirtualMemory tool, but still the effect of the virtual memory is felt since the application crashes when I put a little too much textures in it (comment the texture part and my app works as a charm, and VirtualMemory feels happy to show me I didn't use much resource in that case).
Thanks again, still looking for the Grail
|
|
|
|
|