|
First - when you paste C++ code, please tick the checkbox labelled "Auto-encode HTML when pasting?" That way, your #includes don't get obfuscated.
Secondly - I think your problem will be solved by putting the #include <iostream> before the #define new DEBUG_NEW - STL doesn't get on with MFC's debugging memory allocator, IIRC.
linux_xjtu wrote: Then i would like to employ in .cpp file to prompt some hints with the help of "cout"
so in the .cpp file, #include is used.
I suspect this is the big, indirect problem - do you have a console in your MFC app? Without a console, std::cout won't do you much good.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
I need to be able to display a 3d object on desktop with transparent background so it seems like it's drawn directly to desktop. I managed to do that with layerd window and openGL. Here is the code making my main window layered:
///////////////LAYERD WINDOW/////////////////////////
SetWindowLong (hWnd , GWL_EXSTYLE ,
GetWindowLong (hWnd , GWL_EXSTYLE ) | WS_EX_LAYERED ) ;
typedef DWORD (WINAPI *PSLWA)(HWND, DWORD, BYTE, DWORD);
PSLWA pSetLayeredWindowAttributes;
HMODULE hDLL = LoadLibrary ("user32");
pSetLayeredWindowAttributes =
(PSLWA) GetProcAddress(hDLL,"SetLayeredWindowAttributes");
if (pSetLayeredWindowAttributes != NULL) {
pSetLayeredWindowAttributes (hWnd,
RGB(0,0,0), 255, LWA_COLORKEY|LWA_ALPHA);
}
/////////////////////////END LAYERED WINDOW
I need to be able to have this functionality with DirectX programming. This method didn't work for me. Is this the correct way to do it or maybe some other technique is more proper. I'm thinking maybe using windows regions instead of transparency or something else I'm not aware of.
Any help or advice would be greatly appreciated.
|
|
|
|
|
Hi,
I have one scenario in code that finds all files from the given local/unc path with wildchar. The code sample is given. The enumerator could iterate through the number of files in that path and return the exact path of each file and which will be added to an array for later use..
The above part is working fine..but my requirement is to find the files in similar way with the url path. For eg; the path will be http://server/test/*.bmp and it need to get the url of all file existing on that path like, http://server/test/a.bmp, b.bmp, etc..
Is there any way similar to the code given to do this for url path..I have tried the way OpenUrl() and CinternetSession but it didn't work..Would really appreciate for showing the right way..
CFileFind fileFinder;<br />
char oldDirectory[512]; <br />
GetCurrentDirectory(512,oldDirectory);<br />
BOOL flag= fileFinder.FindFile(pathDirectory+strWildcard);<br />
while(flag )<br />
{<br />
flag = fileFinder.FindNextFile();<br />
lstArray.Add(fileFinder.GetFilePath());<br />
<br />
}<br />
SetCurrentDirectory(oldDirectory);<br />
Thanks in Advance..
SoftwareDeveloper(.NET)
|
|
|
|
|
HTTP doesn't have (as standard) the concepts required to support file finding. Instead, you probably need the server to return a file list when you GET http://server/test/ (many HTTP servers can give directory listings when you access a directory). Then you can filter that file list to work out which files you want to retrieve from the server.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
Stuart,
Thanks much for the quick suggestion..I agree that the way server sending the list of files would be better and will proceed in that way..
Appreciating..
Thanks,
Rahul..
SoftwareDeveloper(.NET)
|
|
|
|
|
There is no MFC class for searching on HTTP servers because HTTP does not support the direct file manipulation required for searches. Can you use CFtpFileFind() ?
"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 think its better try to find elements on the we sites(for example Buttons,Images,Labels,...).
Of one Essence is the human race
thus has Creation put the base
One Limb impacted is sufficient
For all Others to feel the Mace
(Saadi )
|
|
|
|
|
Hi David, Hamid,
Thanks much for your responses and suggestions..just made logic like the server finds the list of files from the folder and sending the list to the client with a delimeter then the activex use it..
Thanks,
Rahul..
SoftwareDeveloper(.NET)
|
|
|
|
|
there is no direct way to do so, as website doesn't provide this due to security reason. there is other way around, you can create a dummy page on server, which search files for you and retrun you teh list when ever you call that page...? hope i am not missing something here!
"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 all,
i m added my application in startup ,but its blocked in case od UAC enabled,
becoz application needs run as admin permission to execute.
At startup time its have not admin permission and than its blocked.
please tell me how can i run in strtup with admin permissions.
thanks in advance.
To accomplish great things, we must not only act, but also dream;
not only plan, but also believe.
|
|
|
|
|
Noticing that when include <fstream> ,ifstream can be introducd like
ifstream source(fileName);
After checking the <fstream> file in nodepad,i can find no class ifstream.
Then <fstream> includes other head files,I check them one by one recursively
but find nothing.
From MSDN,A type basic_ifstream specialized on char template parameters.
typedef basic_ifstream<char,> > ifstream;
and the required head file is <fstream>
Then i was confused.
Thanks for your reply.
|
|
|
|
|
not exactely sure what your problem is ...
I usually :-
#include <iostream>
#include <fstream>
if Im using an ifstream
..... does that help ?
|
|
|
|
|
thank for your concern.
I know it can be used like this ,as what you said.
BUT the question is i have reviewed <fstream> source code,
finding no declaration as what MSDN said:
typedef basic_ifstream<char,> > ifstream;
and even there is no "ifstream" appeared.
and i wonder why.
|
|
|
|
|
linux_xjtu wrote: reviewed source code
What source code?
linux_xjtu wrote: typedef basic_ifstream<char,> > ifstream;
and even there is no "ifstream" appeared.
i wonder why
You must have been looking at the wrong source code. In my Visual Studio installation, the definition of the typedef ifstream is in C:\Program Files\Microsoft Visual Studio 9.0\VC\include\iosfwd, while the definition of basic_ifstream is in C:\Program Files\Microsoft Visual Studio 9.0\VC\include\fstream.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
i am trying to adapt
http://www.codeproject.com/KB/system/AudioConfigurationManager.aspx to work under vista sp2.
Having it all running except for the interaction with the applet's button's
using i can't get it to supply me with information.
This code part gives me a headache:
ZeroMemory(&lvItem,sizeof(LVITEM));
ZeroMemory(&lState,0,sizeof(LVITEM));
ZeroMemory(&item,512);
defaultButton = handAcq->findChildWindow(appletWindow,BUTTON,DEFAULT_BUTTON);
listView = handAcq->findChildWindow(appletWindow,COMBO_BOX,NULL);
GetWindowThreadProcessId(listView,&procID);
HANDLE lView=OpenProcess(PROCESS_VM_OPERATION|PROCESS_VM_READ|PROCESS_VM_WRITE|PROCESS_QUERY_INFORMATION,false,procID);
if (lView)
{
LVITEM *_lvi=(LVITEM*)VirtualAllocEx(lView, NULL, sizeof(LVITEM),MEM_COMMIT,
PAGE_READWRITE);
char *_item=(char*)VirtualAllocEx(lView, NULL, 512, MEM_COMMIT, PAGE_READWRITE);
lvi.cchTextMax=512;
lvi.pszText=_item;
_lvi->stateMask= (UINT)-1;
_lvi->mask=LVIF_STATE;
if (applyButton && defaultButton) //found buttons
{
// THIS DOESN'T WORK, RETURNS AN EMPTY lvitem STRUCTURE
SendMessage(listView, LVM_GETITEMSTATE, (WPARAM)0, (LPARAM)_lvi);
ReadProcessMemory(lView, _lvi, &lState, sizeof(LVITEM), NULL);
// THIS WORKS AND RETURNS THE ITEM NAMES
SendMessage(listView, LVM_GETITEMTEXT, (WPARAM)0, (LPARAM)_lvi);
ReadProcessMemory(lView, _item, item, 512, NULL);
}
There are no errors, just ignores any interaction with the applet other then retrieving strings.
What am i doing wrong?
modified on Saturday, April 25, 2009 9:02 AM
|
|
|
|
|
Hi,
The other day I just figured out the Vista has different interface for accessing mixers (volume controls) because of new security restrictions it only allow your application to see stuff in your level,
In other words - you can only set / select the audio channel that your application is using,
Look at this:
IAudioEndpointVolume Interface[^]
Best Regards - Yovav Gad
CEO and founder of MicroMighty, Inc.
|
|
|
|
|
Tnx for the input, i've already given up on using the Directx SDK. That's why i took the workaround, by calling the sound applet and just manipulating the message queue. I want to toggle the Realtek HD Audio between the speaker and digital output by code. Just read the itemstrings, see if they have a image state mask and move the cursor to the other one and push the setdefault button.
The kludge given by http://www.codeproject.com/Members/odlumb for xp works in xp, just under vista the applet doesn't respond
|
|
|
|
|
snoepie wrote: SendMessage(defaultButton, LVM_GETITEMSTATE, (WPARAM)0, (LPARAM)_lvi);
Something called 'defaultButton' is a list view? Either you've got the wrong control, or your naming convention is...very, very odd!
Judging by the call afterwards, you've got the wrong control
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
blindingly obvious stupid mistake on my part.
Read over it a 1000 times. Stupid me, tnx. It's just so enormously frustrating to get a simple task done i've lost track
|
|
|
|
|
updated source code. same effect unfortunately
|
|
|
|
|
Looking in your original code, you attempt to initialise the LVITEM @ _lvi using these two lines:
_lvi->stateMask= (UINT)-1;
_lvi->mask=LVIF_STATE;
but that memory is in a different process! I think you need to use WriteProcessMemory to do that?
I just tried your code and my process crashed, probably because the address that _lvi refers to wasn't allocated in my progrm (but it is in yours?).
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
bingo! needed just a fresh eye. Been at it for more then a week now. Started with directx to find out the obvious and finally hooked up with this kludge.
Works fine now. I'll upload the finished code when done as an addition to the XP version. Added commandline switches for toggling
|
|
|
|
|
when i review <iostream> showing somewhat like this,
namespace std {
extern istream cin;
extern ostream cout;
extern ostream cerr;
extern ostream clog;
extern wistream wcin;
extern wostream wcout;
extern wostream wcerr;
extern wostream wclog;
};
Such globals like cin,cout,cerr are considered to be defined in other files accoring to "extern" keyword.But I have not got where they are defined from MSDN. So i wonder if they are defined in just <iostream> ,although with extern keyword included.
Thanks very much for your reply.Appreciating.
|
|
|
|
|
linux_xjtu wrote: But I have not got where they are defined from MSDN.
They are defined in the C++ runtime library, which automatically gets linked in if you compile and link C++ code.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
Thanks for your concerning.
|
|
|
|
|