|
Ram Murali wrote: ut now i can able to key-in only one character. cannot key-in more than one char.
create a string there only!
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
In PPC emulator in VS2005, I create a button in ChildView to call a CSettingPropSheet. I also create a Dialog called dlgSettingPage and use CSettingPropSheet->AddPage(&dlgSettingPage).
I create a CComboBox in dlgSettingPage using CComboBox.Create(...) in OnInitDialog(). When I rorate the screen, I want to resize and relocate the CComboBox. What function could I use to resize and relocate the object and What message in PPC emulator could I call the function??
Any suggestion is useful!! Thanks!!
|
|
|
|
|
Hi
I have a theory question on thread.
How can we pass class object from one thread to other, in Multi thread env.
What are the things we should be careful in this operation.
Any good link to clarify these things more.
Regards
Anil
|
|
|
|
|
See Here[^] maybe it is some helpful to you
whitesky
|
|
|
|
|
Hello everyone
I need to start/stop screensaver in my program, Please give me some hints how to do. Thanks.
-Freehawk
|
|
|
|
|
sunyw_2006 wrote: I need to start/stop screensaver in my program, Please give me some hints how to do. Thanks.
For Starting ScreenSaver you can post this message:-
::PostMessage(HWND_BROADCAST,WM_SYSCOMMAND,SC_SCREENSAVE,0);
For Stoping it manually, Simulate Mouse Click at 0,0 position:-
mouse_event(MOUSEEVENTF_LEFTDOWN,0,0,0,0);;
mouse_event(MOUSEEVENTF_LEFTUP,0,0,0,0);;
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
Hi there, I have found a similar topic here:
http://www.codeproject.com/csharp/codecompilation.asp
but unfortunately it is in C# and I cannot understand the more complex workings. Does anyone know of a link, site, tutorial etc. where I can find something similar?
How would you go about protecting the contents of your Main Header file from being decompiled once in exe form? I am currently trying to decrypt, the encrypted source code contained in the header file to execute the program. In other words, Form1.h is encrypted, and at runtime/compile, the program needs to decrypt the text in the header file to execute the program. (PS: I already have the encryption/decryption i'm going to use.
Any help on this subject would be greatly appreciated.
Regards
Linden
|
|
|
|
|
|
oh sorry, i forgot to mention that I'm currently coding in Visual C++ 2005 Express Edition if that helps. I looked at your reply Chris but this compiles strings with a password, could you actually enter your entire header file's contents into this .cpp file? the control declarations etc?
|
|
|
|
|
Nokoff wrote: could you actually enter your entire header file's contents into this .cpp file? the control declarations etc?
i guess i don't understand what you're trying to do... there's no need to try to encrypt the contents of C++ source on a file level - a 'header file' does not appear in the EXE in any recognizable form. you wont see variable names, function declarations or anything like that in an EXE (unless you release a Debug build). the only thing that really survives the compilation process intact are literal (ie. quoted) strings.
Cleek | Image Toolkits | Thumbnail maker
|
|
|
|
|
Hi,
I'm relatively new to the .NET framework although I have been programming for a while now (more algorithmic, and now I'm making a shift towards more developing)
I have some third party code originally written in linux which i would like to compile and use in some web services that I have in visual studio.
The project files that I have are organised in folders like init, include etc. It also has a main .c file.
So I created a new win 32 console project (i had done something similar in the past) in vs and first added the include files, and then the main.c file. When I try and build the project, I get a fatal error: C1083: cannot open include file rhessys.h
but i already added the header file to the project so what is the problem? Should i add the remaining files in the resource folder or the source folder?
I frequently have to bring a lot of code from linux to visual studio, is there a faster, more efficient way to do this?
if someone would like to look at the project folder i will upload it.
Thanx in advance!
|
|
|
|
|
The headers included in your VC-project have nothing to do with compile errors. Check source files for #include statements. As far as I know, rhessys.h is not a Windows header.
Porting stuff from linux to Windows should (IMHO) be done manually, not with magical tools.
|
|
|
|
|
Don't mean to disappoint you, but Unix/Linux code cannot be easily ported from/to Windows, unless
1) the code is trivial (extremely simple), or
2) the code was written in a portable way
Here is a list of most unportable items:
1) GUI
3) Networking
3) IPC
4) Unsupported features
Best,
Jun
|
|
|
|
|
Hi,
I have a dialog that was previously a child window of another window. This dialog implements a custom control that notifies the parent using by sending custom WM_COMMAND messages.
I want to change this window to be a popup window but to remain a control of the parent dialog.
The problem is that once I change the window's style to popup() the SetDlgCtrlID() function fails.
GetLastError() reports:
1401: Invalid menu handle.
I have tried setting the id using ::SetWindowLong() as well, but I got the same error message.
Is it not possible to make a popup act as a control of another window? I need this control to be flexible enough so that it can be embedded in another window or to float on its own. I would prefer to use the WM_COMMAND message for sending notifications instead of defining a new window message for each notification.
Any help is appreciated.
Thank you,
Tom
|
|
|
|
|
Hi.
I have a program that terminates name given process. But it doesn't terminate most of processes. For example terminates calc.exe but doesn't terminate winamp.exe. I think some privilege issue but not sure. Here is my code:
void TerminateProcess(char *szProcToTerminate)
{
hProcessSnap = CreateToolhelp32Snapshot( TH32CS_SNAPPROCESS, 0 );
pe32.dwSize = sizeof( PROCESSENTRY32 );
if( !Process32First( hProcessSnap, &pe32 ) )
{
CloseHandle( hProcessSnap );
}
char chhh[260];
do{
sprintf(chhh, "%s", pe32.szExeFile);
dwPriorityClass = 0;
hProcess = OpenProcess( PROCESS_ALL_ACCESS, FALSE, pe32.th32ProcessID );
if(stricmp(pe32.szExeFile, szProcToTerminate) == 0)
{
TerminateProcess(hProcess, 0);
}
} while( Process32Next( hProcessSnap, &pe32 ) );
CloseHandle( hProcessSnap );
Refresh();
}
How can i modify this function to terminate "all kind of" processes.
|
|
|
|
|
frbry wrote: I think some privilege issue ...How can i modify this function to terminate "all kind of" processes.
If you know it to be a "privilege issue," then why not adjust the privilege accordingly? Search for:
OpenProcessToken()<br />
LookupPrivilegeValue()<br />
AdjustTokenPrivileges()
"The largest fire starts but with the smallest spark." - David Crow
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
I already looked them but i didn't understand how to put together!
|
|
|
|
|
See my example here.
"The largest fire starts but with the smallest spark." - David Crow
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
It may also be the case that the process is stuck in kernel space, waiting for some object to become signalled? It wouldn't be the first (nor the last) time winamp hung. Does TerminateProcess() return FALSE, and if so, what does GetLastError() return?
--
Not Y3K Compliant
|
|
|
|
|
I need to develop some control looking like this
please help with some ideas,
i think the best way is to derive a class frow CWnd and inside it make some CStatic controls wich will display images using GDI+, but if you have some expirience or know some doc or place to look at, please post it.
P.S.: I'm beginner in MFC
|
|
|
|
|
Probably just write a custom control and paint everything yourself. Windows are rather expensive objects and I don't see why you need so many windows to do something as simple as a BitBlt(). None of the windows common controls use GDI+, only GDI.
The only question I think is whether to extract all the thumbnails when the video is loaded and cache it, or generate and cache them on the fly.
Here's an article on creating custom controls.
http://www.codeproject.com/miscctrl/customcontrol.asp[^]
|
|
|
|
|
Hi fellows
I'm developed an app that generates a xml file with some nodes.
it works file, but a little different thing is occuring: the nodes and the filename are saved with chinese(or japanese, I don't know) characters.
I have a function that transforms a string to BSTR. I've verified if the functions works fine and it works, It doesn't convert to chinese os japanese chars. If I define BSTR in the SaveXML function the nodes are saved correctly.
I think that the problem occurs in my conversion to BSTR, but I'm not 100% certainly.
This is the code:
<br />
void myClass::SaveTheXML()<br />
{<br />
BSTR string; <br />
BSTR theString, theString2; <br />
VARIANT theVar, theVar2; <br />
string = L"teste.xml"; <br />
theString = L"arquivo"; <br />
theString2 = L"valor"; <br />
VariantInit(&theVar); <br />
VariantInit(&theVar2); <br />
V_BSTR(&theVar) = SysAllocString(string); <br />
V_BSTR(&theVar2) = SysAllocString(theString2); <br />
V_VT(&theVar) = VT_BSTR; <br />
V_VT(&theVar2) = VT_BSTR; <br />
parent = CreateXMLElement(sNode1); <br />
child = CreateXMLElement(sNode2); <br />
xmlDocument->createElement(L"primeiro", &parent); <br />
xmlDocument->createElement(L"segundo", &child); <br />
InsertChildNode(parent, child); <br />
InsertChildNode(xmlDocument, parent); <br />
xmlDocument->save(ReturnVariantString(xmlFileName));<br />
}<br />
So, fellows what's going on? Thanks a lot for the support. Below the code that I developed:
<br />
void myClass::InsertChildNode(IXMLDOMNode * parentNode, IXMLDOMNode * childNode) <br />
{ <br />
IXMLDOMNode * localNode = NULL; <br />
handleResult = parentNode->appendChild(childNode, &localNode); <br />
if(localNode == NULL)<br />
{<br />
MessageBox(NULL, "Erro na inserção do node", "Erro", MB_OK|MB_ICONERROR);<br />
return;<br />
}<br />
} <br />
void myClass::SaveTheXML()<br />
{ <br />
string sNode1, sNode2, xmlFileName, sAttribName, sAttribValue; <br />
IXMLDOMAttribute * tempAttribute = NULL; <br />
sNode1 = "primeiro"; <br />
sNode2 = "segundo"; <br />
xmlFileName = "teste.xml"; <br />
sAttribName = "arquivo"; <br />
sAttribValue = "valor"; <br />
parent = CreateXMLElement(sNode1); <br />
child = CreateXMLElement(sNode2); <br />
theAttribute = CreateXMLAttribute(sAttribName, sAttribValue); <br />
child->setAttributeNode(theAttribute, &tempAttribute); <br />
InsertChildNode(xmlDocument, theAttribute); <br />
InsertChildNode(parent, child); <br />
InsertChildNode(xmlDocument, parent); <br />
xmlDocument->save(ReturnVariantString(xmlFileName)); <br />
} <br />
<br />
VARIANT myClass::ReturnVariantString(string sNodeName) <br />
{ <br />
VARIANT variant;<br />
VariantInit(&variant); <br />
V_BSTR(&variant) = SysAllocString(StringToBSTR(sNodeName)); <br />
V_VT(&variant) = VT_BSTR; <br />
return variant; <br />
}<br />
<br />
IXMLDOMElement * myClass::CreateXMLElement(string sNodeName)<br />
{ <br />
IXMLDOMElement * xmlElement = NULL; <br />
BSTR sTemp = StringToBSTR(sNodeName); <br />
handleResult = xmlDocument->createElement(sTemp, &xmlElement); <br />
if(xmlElement == NULL)<br />
{<br />
MessageBox(NULL, "Erro na criação do node", "Erro", MB_OK|MB_ICONERROR); return NULL;<br />
} <br />
return xmlElement;<br />
}<br />
IXMLDOMAttribute * myClass::CreateXMLAttribute(string sAttributeName, string sAttributeValue)<br />
{ <br />
IXMLDOMAttribute * theAttribute = NULL; <br />
xmlDocument->createAttribute(StringToBSTR(sAttributeName), &theAttribute); <br />
handleResult = theAttribute->put_value(ReturnVariantString(sAttributeValue)); <br />
if(handleResult != S_OK)<br />
{<br />
MessageBox(NULL, "Erro na criação do atributo do node", "Erro", MB_OK);return NULL;<br />
} <br />
return theAttribute;<br />
}<br />
<br />
BSTR myClass::StringToBSTR(string sValue)<br />
{<br />
BSTR sTemp = (BSTR)(const char *)sValue.c_str(); <br />
return sTemp;<br />
}<br />
|
|
|
|
|
Alex Cutovoi wrote: BSTR myClass::StringToBSTR(string sValue)
{
BSTR sTemp = (BSTR)(const char *)sValue.c_str();
return sTemp;
}
This will give you interesting results at best. The reason is that BSTRs have to be allocated (you haven't allocated anything in this method). A replacement would be:
_bstr_t myClass::StringToBSTR(const std::string& value)
{
_bstr_t bstrValue(value.c_str());
return bstrValue;
}
You can pass _bstr_t's into MSXML's method calls because it overrides the BSTR() operator for you.
If you decide to become a software engineer, you are signing up to have a 1/2" piece of silicon tell you exactly how stupid you really are for 8 hours a day, 5 days a week
Zac
-- modified at 16:36 Wednesday 5th July, 2006
|
|
|
|
|
Two questions Zac:
1)What's the _bstr_t?Is it a private variable that I must to declare?I tried this and doesn't work.
2)I don't understand this: bstrValue(value.c_str()); What is the bstrValue?
|
|
|
|
|
_bstr_t is a helper class that Microsoft wrote. Check here for the documentation.
Line by line, the code I wrote does the following:
_bstr_t myClass::StringToBSTR(const std::string& value)
{
_bstr_t bstrValue(value.c_str());
return bstrValue;
}
I believe I forgot the return line in the previous post ... sorry about that.
If you decide to become a software engineer, you are signing up to have a 1/2" piece of silicon tell you exactly how stupid you really are for 8 hours a day, 5 days a week
Zac
|
|
|
|
|