|
|
It was very useful for my problem. thanks
|
|
|
|
|
Its good news for me it was helpful for you.
|
|
|
|
|
Hamid. wrote: Its good news for me it was helpful for you.
Hows life going dude... evrything ok at your END
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow Never mind - my own stupidity is the source of every "problem" - Mixture
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
Hi Experts,
I have written a shell context menu COM dll. It is working fine on all files and folders. But this is not coming on briefcase. How can I achieve that.
|
|
|
|
|
I would suspect that the briefcase is not a real directory, but a namespace extension (like the recycle bin). In which case, you might be out of luck.
For this sort of thing, I use regmon from sysinternals. Navigate to the "directory", start regmon going, and see what COM reads explorer does when you right click on a briefcase item. It may not even look at the keys you have your extension registered under, which would be a hint to give up, or look if any of the keys it *does* look at give you any ideas.
Iain.
Plz sir... CPallini CPallini abuz drugz, plz plz help urgent.
|
|
|
|
|
Hi!
I'm trying to make all DropDown-Menus transparent, using a WH_CBT hook.
Unfortunately it does not work ...
Here is the Hookprocedure:
<br />
LRESULT CALLBACK TransWindowProc(int nCode, WPARAM wParam, LPARAM lParam)<br />
{<br />
if (nCode < 0)<br />
return CallNextHookEx(g_hTransHook, nCode, wParam, lParam);<br />
<br />
<br />
<br />
if (nCode == HCBT_CREATEWND)<br />
{<br />
<br />
HWND handle = (HWND)wParam;<br />
<br />
LPWSTR szClass = new WCHAR[128];<br />
GetClassName(handle, szClass, 127);<br />
<br />
<br />
<br />
if (lstrcmpi(szClass, TEXT("#32768")) == 0)<br />
{<br />
<br />
SetWindowLong(handle, GWL_EXSTYLE, GetWindowLong(handle, GWL_EXSTYLE) | WS_EX_LAYERED);<br />
SetLayeredWindowAttributes(handle, 0, 200, LWA_ALPHA);<br />
<br />
}<br />
}<br />
return CallNextHookEx(g_hTransHook, nCode, wParam, lParam);<br />
}<br />
The hook itself is in a dll and is installed correctly. The if-statement is entered, but no transparency is set.
Can anybody please help ?
|
|
|
|
|
Hi,
I was trying to find some way to change a const value using pointers (just for the hell of it).
I guessed const is a compile time restriction and not a runtime one.
I came across this.
The code compiles and runs without any error.
It displays 12 20, even though the code suggests p and y must be having a value of 20.
I am surely missing something here. Please help.
<br />
void main()<br />
{ <br />
int *px;<br />
const int p = 12;<br />
px = (int *)&p;<br />
*px = 20;<br />
int y = p;<br />
cout << y << " " << *px; <br />
}
Then I tried this.
I made p a global variable. This one compiles without any error or warnings(highest level).
However throws access violation on *px = 20; at runtime! This is against my (wrong?) understanding of const.
Please can someone throw some light on this issue?
<br />
const int p = 12;<br />
void main()<br />
{ <br />
int *px; <br />
px = (int *)&p;<br />
*px = 20;<br />
int y = p;<br />
cout << y << " " << *px; <br />
}<br />
I used MSVS 6.0 compiler.
modified on Friday, April 18, 2008 9:38 AM
|
|
|
|
|
I have a (very loose) theory, but words escape me at the moment. Making a variable const only tells the compiler to not allow reassignment of p . The data (of p ) is not in a special location, it can still be altered by px (to 20). When you printed the value of p in the first example, even though it had been changed indirectly by px , the compiler knew that it was a const and thus returned its original, read-only value.
That's as bad of a description as I can give you at this point.
"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
|
|
|
|
|
Hi David,
Thanks for the reply, I really appreciate it.
Definitely compiler is playing some role here. I will check the assembly code that's generated.
I am wondering how the runtime error is generated in the second part of my problem.
Thanks
Paul
|
|
|
|
|
In the second case the compiler has almost certainly placed p into a readonly segment as it's a global constant. I know MSVC 6 does this with strings so it's not really a great surprise it does it with an int.
In the first case I would speculate that you're falling foul of optimization. Try turning off all optimization in you compiler/project settings and see if it still occurs. I would certainly class that as a compiler bug though, not the only one in VC6 by a long chalk
"The secret of happiness is freedom, and the secret of freedom, courage."
Thucydides (B.C. 460-400)
|
|
|
|
|
Matthew Faithfull wrote: Try turning off all optimization in you compiler/project settings and see if it still occurs. I would certainly class that as a compiler bug though, not the only one in VC6 by a long chalk
I turned off optimization and the misbehaviour still stands (even on VS2008 compiler).
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
|
|
|
|
|
spot on Matthew!
I did a disassembly and ds:dword_4110E8 is indeed in .rdata and hence the error.
the first issue, I am still getting it even with optimization off.
<br />
_main proc near ; CODE XREF: start+AFp<br />
.text:00401080 push 14h<br />
.text:00401082 push offset unk_4140B0<br />
.text:00401087 push 0Ch<br />
.text:00401089 mov ecx, offset unk_417EE0<br />
.text:0040108E mov ds:dword_4110E8, 14h<br />
.text:00401098 call sub_4010B0<br />
.text:0040109D push eax<br />
.text:0040109E call sub_4014E0<br />
.text:004010A3 add esp, 8<br />
.text:004010A6 mov ecx, eax<br />
.text:004010A8 call sub_4010B0<br />
.text:004010AD retn<br />
.text:004010AD _main endp<br />
<br />
.rdata:004110E8 dword_4110E8 dd 0Ch <br />
modified on Friday, April 18, 2008 4:38 PM
|
|
|
|
|
<br />
void main()<br />
{ <br />
int *px;<br />
const int p = 99;<br />
px = (int *)&p;<br />
*px = 77;<br />
int y = p;<br />
}<br />
I did a disassembly of the above (VS 6 debug disassembly window) and this is what I found.
bit strange, I didnt expect the compiler to replace every instance of 'p' with its value like a #define.
I mean, I expected
<br />
0040127E mov dword ptr [ebp-0Ch],dword ptr [ebp-8] <br />
instead of
<br />
0040127E mov dword ptr [ebp-0Ch],63h<br />
complete disassembly
<br />
00401268 mov dword ptr [ebp-8],63h<br />
16: px = (int *)&p;<br />
0040126F lea eax,[ebp-8]<br />
00401272 mov dword ptr [ebp-4],eax<br />
17: *px = 77;<br />
00401275 mov ecx,dword ptr [ebp-4]<br />
00401278 mov dword ptr [ecx],4Dh<br />
18: int y = p;<br />
0040127E mov dword ptr [ebp-0Ch],63h<br />
|
|
|
|
|
error LNK2001: unresolved external symbol _pay
fatal error LNK1120: 1 unresolved externals
I am trying out a simple code and getting the above two errors. Kindly please help me out to get rid of them.
My code is below
Source..
#include "cdll.h"
#include <iostream.h>
__declspec(dllexport) int pay(int days,int salary)
{
int total;
total=days*salary;
return total;
}
Header...
#ifndef CDLL_H
#define CDLL_H
__declspec(dllexport)int pay(int days,int salary);
#endif
main..
#include <stdio.h>
#include "cdll.h"
#include <conio.h>
void main()
{
int days;
long salary;
char name[30];
printf("Enter name of employee:");
scanf("%s",name);
printf("\n Enter days worked:");
scanf("%d",&days);
printf("\n Enter wages per day:");
scanf("%d",&salary);
printf("\n NAME:%s",name);
printf("\n MONTHLY INCOME:%d",pay(days,salary));
getch();
}
Please help me out.
Thanks
modified on Friday, April 18, 2008 9:31 AM
|
|
|
|
|
pl_kode wrote: error LNK2001: unresolved external symbol _pay
See here.
pl_kode wrote: fatal error LNK1120: 1 unresolved externals
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
|
|
|
|
|
Did you add cdll.lib to your project?
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
|
|
|
|
|
yes, after add cdll.lib in the project>settings...
I am getting an error saying that cannot open cdll.lib
|
|
|
|
|
pl_kode wrote: I am getting an error saying that cannot open cdll.lib
Is this a linker error?
"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
|
|
|
|
|
|
So does cdll.lib exist, and have you specified the correct path to it? When the linker says it cannot find a file, that's the place to start looking.
"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
|
|
|
|
|
Please read the posting guidelines at the top of the forum, especially the bit about including code in pre tags, so we can see what files you are including.
But as was said, pay appears to be in a DLL, so you'll need to add (eg) CDLL.lib into your file (look at linker options).
Iain.
Plz sir... CPallini CPallini abuz drugz, plz plz help urgent.
|
|
|
|
|
Hi to all,
I have some questions regarding DirectShow programming in VC++,
1. How to do MultiGraph Programming ?
I got a "GMFBridge" source code, but its gives compiling error. And I didn't understand the code.
2. Is there any alternative for "MPEG-2 Multicast Receiver" filter ?
Thanks in Advance.
Regards,
Aniket A. Salunkhe
|
|
|
|
|
Hello guys,
I've one problem.
Suppose user opens any .txt,.doc,.pdf file in local PC.
I want to read the attributes of the files like moddified,created,close.
How is this can be done with VC.
Thanks to all of you in Advance.
ritz1234
|
|
|
|
|
You can use CFile::GetStatus(), if you're using MFC.
Nobody can give you wiser advice than yourself. - Cicero
.·´¯`·->Rajesh<-·´¯`·.
Codeproject.com: Visual C++ MVP
|
|
|
|
|