|
I had written an application in a language version. All displaying strings in my application were written in this language in the string table.
Now, How could I add support for other languages without modifying the existed resources?
Is it possible to be done by adding resources such as string table in other languages?
What should I do to use resources of the specified language and let the IDE build an application of specified language?
I'll appreciate your help, thanks~~!
|
|
|
|
|
|
Hi, I need to get the domain name (not the controller domain name) of a remote computer. I'm using NetWkstaGetInfo function and I tried to use it, but I have got problems. This function works correctly when I try to get domain name of local computer but it returns an error when I tried to get information about a remote computer. This is the function code:
BOOL GetDomainName(char *szTerminal, char *szDomain)
{
PWKSTA_INFO_100 pBufferInfo;
NET_API_STATUS err = 0;
DWORD dwBytes;
WCHAR *swzTerminal = NULL;
dwBytes = MultiByteToWideChar(CP_ACP, 0, szTerminal, -1, NULL, 0);
swzTerminal = malloc(dwBytes* sizeof(TCHAR));
dwBytes = MultiByteToWideChar(CP_ACP,
0,
(LPCSTR)szTerminal,
-1,
swzTerminal,
dwBytes);
err = NetWkstaGetInfo((char *)swzTerminal,
(DWORD)100,
(LPBYTE *)&pBufferInfo);
if(err != NERR_Success)
{
return FALSE;
}
WideCharToMultiByte(CP_ACP,
0,
(LPCWSTR)pBufferInfo->wki100_langroup,
-1,
szDomain,
MAX_PATH,
NULL,
NULL);
return TRUE;
}
The returned error is err = 5 (ERROR_ACCESS_DENIED)
I read some Microsoft information about privileges required for executing this function. But I executed the program with an local administrator user in Windows 2K and NT and got the same problem. I just need information about the domain name, not modify anything. Maybe is there a posiblity of querying information with a lower level that don't require administrator privileges.
I've seen some commercial programs (like Dameware) that obtains the domain name just with IP address of remote computer, without establishing any connection (and introducing username and password). I am trying to do the same.
In the NetWkstaGetInfo information appears:
"You must have Print or Server operator privilege, or be a member of the Administrator or Account local groups to successfully execute NetWkstaGetInfo at level 0 or level 1 on a remote server. No special privilege is required for level 10 calls."
How can I do level 10 calls?
Thanks.
|
|
|
|
|
In my application, com component created a window which is not a com object(for example: CWindow ), and has a method to get the window's HWND.But I want to show the window in MFC's Splitter view.
I try to attach Splitter view to the window, but failed. who can tell me how to do this, thanks very much.
hdfhfgh
|
|
|
|
|
Hi
I'm using CHtmlEditCtrl to edit HTML documents.
The following code is used to load the file into the document object. It works fine when the document is initally loaded, but once the file has been edited and saved by the document object itself, the file does not load correctly.
I'm not to hot on reading from files, so any suggestions would be appriciated.
Many Thanks
Mark
if(f.Open(m_sEditingFile, CFile::modeRead))
{
while(f.ReadString(sIn))
{
SAFEARRAY* psa = SafeArrayCreateVector(VT_VARIANT, 0, 1);
VARIANT *param;
SafeArrayAccessData(psa, (LPVOID*)¶m);
param->vt = VT_BSTR;
param->bstrVal = sIn.AllocSysString();
pDoc->writeln(psa);
}
}
|
|
|
|
|
All
Found my own answer...
IHTMLDocument2 *pDoc;
if(m_pHtmlEditCtrl->GetDHtmlDocument(&pDoc))
{
LPDISPATCH lpDispatch = NULL;
IPersistFile *lpPersistFile = NULL;
// m_ctrl is an instance of the Web Browser control
pDoc->QueryInterface(IID_IPersistFile, (void**)&lpPersistFile);
lpPersistFile->Load( sFilename.AllocSysString(),0);
lpPersistFile->Release();
}
This came from code I found documented to save the file. A quick check and the IPersistFile did include a "load".
The thing that gets me is "where is this documented", they are all MS controls yet I can't find any of this on the MSDN site. I spent more time looking for examples of code and objects than I do designing the software and coding....
How the above code is a help to anyone else playing with these controls.
Mark
|
|
|
|
|
Hi
This is the basic layout of what I am doing:
(1) I have created a CPropertySheet() class that has a few CPropertyPages added to it. The CPropertySheet is set in wizard mode.
(2) For some CPropertyPage instances of CPropertyPage, the OnWizardNext determines which page will be viewed next. I thought that this should be simple enough and I can call (CPropertySheet*)GetParent() from CPropertyPage and then call CPropertySheet::SetActivePage with the page number that should be viewed next.
However, this does not work and I am not sure how and where SetActivePage() should generally be called from. The Visual C++ docs on this topic are sparse. If someone has used SetActivePage before or knows a clean way to change the ordering of the pages in a property sheet, please reply.
Thank you
|
|
|
|
|
|
In your CPropertyPage derived class, override OnWizardNext() and return the id of the CPropertyPage to be displayed. You can also return 0 for the default next page or -1 to prevent the wizard from advancing.
/ravi
My new year's resolution: 2048 x 1536
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
Thanks
I just worked that out. For anyone else who is trying to use SetActivePage for changing the order of pages in CPropertySheet, please don't. Just read this in the MSDN docs for OnWizardBack and OnWizardNext:
Return Value
0 to automatically advance to the next page; –1 to prevent the page from changing. To jump to a page other than the next one, return the identifier of the dialog to be displayed.
|
|
|
|
|
I have a sb live CT4780 card. Can I program its EMU chip. Are there any four channel audio files on the net which can be used to check its capabilities? Which player should I use then? Will winamp 2.8 work? Or should I use its 4 channel plugin? (If it exists...)
|
|
|
|
|
Try looking for video files that have an AC3 sound track. Or, you could use a DVD with surround... e.g. the Matrix.
Joel Holdsworth
Wanna give me a job this summer?
Check out my online CV and project history[^]
|
|
|
|
|
This sounds very simple, well I have a little problem trying to do that in VC++. I created a form application with .Net and the default form is perfect. I added the second one and for some reason when I include the second form's header it give me an error:
ObjIdl.h(246) : warning C4935: assembly access specifier modified from 'public'
ObjIdl.h(258) : warning C4935: assembly access specifier modified from 'public'
ObjIdl.h(7408) : error C2872: 'IDataObject' : ambiguous symbol
could be ObjIdl.h(246) : System::Windows::Forms::IDataObject IDataObject'
or 'stdafx.cpp(0) : System::Windows::Forms::IDataObject'
ObjIdl.h(7422) : fatal error C1903: unable to recover from previous error(s);
Well if anyone knows how to fix this...
Kamui
|
|
|
|
|
How to write device drivers compatible with both Win 95/98 – resources, steps, what development tools are needed, etc.
Tell me why
|
|
|
|
|
Your best bet would be to look at the Windows DDK and samples to learn about specific platform differences. Knowledge of assembly and C are helpful.
|
|
|
|
|
I have created project using VC6, SDI with some formviews. I can switc:(h these views with no problem. In the Doc, I do SERIALIZE with some CString with no problem, but when I use the derived Edit Control like CMyNumeric to create some edit boxes, and using variable in the private: like double Edit1; and so on. I do evrything the same as with CString but I have problem and don't know why only one data with numeric left over when I switch between forms, but all CString are still there. Could anyone help me, please? Where to be fixed?
TIA
Tony
|
|
|
|
|
Hi-- I've been banging my head trying to solve this problem. Of course I'm a self trained pseudo programmer who just started to use STL. I have a huge file with 10 million entries that are paired, say:
1 8
1 5
1 3
2 0
2 4
3 0
3 8
etc...
They are stored as a two dimensional array of 10 million rows and two columns... you get the idea of the data. I need to find the records in the file that have one and only one of the tags in the first entry of the pair and put the second in another vector file in the order found. For example, if I need records with the tag 2, I'll create the vector
0
4
I suppose I need to use a multimap, but do not know how to read the file and then store the results in a vector. Right now I have this simple code:
typedef vector DVECTOR;
DVECTOR FDV;
int tag;
double FD;
int id = 3;
int idp = id + 1;
while(tag != idp)
{
GetData >> tag >> FD;
cout << tag << " " << FD << endl ;
if(tag == id)
FDV.push_back(FD);
}
This does what I want by scaning the file from the begining until it finds the target value and reads all the entries with such value. If the number is close to the first entry, cool it's fast, but if it is near the end it will take a long time (big program repeated many times...). The question is, would the multimap work better and faster to do the same task? If so... how do I do it??? that is, read the file, store the data in a multimap, search for the tag number of my interest and copy all values associated to the tag number into a vector. If I have to read the whole 10 million line file to put it in a map, then it's going to be hanging around in memory for further use (several times)... or should I read the file every time I need it?? If so, then, isn't my naive code more efficient???
Thank you so much!
Carlos
|
|
|
|
|
Hi,
If your data is in memory, yes it is a multimap you need. You fill it like this:
typedef multimap<int,int> mmapint ;
mmapint mapData;
mapData.insert(mmapint::value_type(1,8));
mapData.insert(mmapint::value_type(1,5));
...
To find the data,use this
vector<int> vecResults;
mmapint::const_iterator iteWhere = mapData.find(nSearchedValue);
while ( iteWhere != mapData.end() )
{
if ( iteWhere->first != nSearchedValue)
break;
vecResults.push_back(iteWhere->second);
iteWhere++;
}
Now, if each time you are going to do a search, you are reading the whole file into memory, you might as well collect the information as you read it... And if your file is sorted, then you should probably do a search by doing successive seeks and halfing the extent of your search... moving to the first one and iterate until you find all of them.
Hope this helps!
|
|
|
|
|
YOU ARE AWSOME!!!!
THANK YOU THANK YOU THANK YOU!!!
CARLOS
|
|
|
|
|
1. If your source file does not change,
2. and you read it each time, or keep the file handle open,
3. it is already sorted by your first key,
then you might also optimize your existing system by keeping track of the file position where each set of elements begin. That is, where do the 1 begin, the 2 begin, the 3 begin, etc. Then you can SetFilePosition() or seek() to that spot, and at least read until you get something NOT matching your number.
Otherwise, if always in memory, then use the multimap.
|
|
|
|
|
GREAT IDEAS!
THANK YOU!
CARLOS
|
|
|
|
|
I am trying to inject a dll into all running processes so I can hook all calls to CreateProcess(). I am going to intercept all calls to CreateProcess() by modifying the IAT, I know how to do that. My problem is injecting the dll into all processes using SetWindowsHookEx(). This is my code, it runs once or twice (triggering the MessageBox function in the main program), and then if you run it again, the computer freezes (and doesn't trigger the MessageBox function in the main program, meaning it got stuck on the InjectEnable() function). If anyone knows what the problem is, that would be highly appreciated.
// Main program:
#include <windows.h> //windows header
#include <stdio.h> //stdio header
#include "MyDLL.h"
#pragma comment(lib,"MyDLL.lib")
int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
{
InjectEnable(); // Function in MyDLL.dll, enables injection
MessageBox(NULL,"End Application","Notification",MB_OK);
InjectDisable(); // Function in MyDLL.dll, disables injection
return 0;
}
// DLL cpp file:
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
#include <windows.h> // Windows header
#include "MyDLL.h"
// Global variables (shared)
#pragma data_seg (".shared")
HHOOK g_hHook = 0;
#pragma data_seg ()
#pragma comment(linker,"/SECTION:.shared,RWS")
// Global variables (unshared)
HINSTANCE hDll;
BOOL APIENTRY DllMain( HANDLE hModule,
DWORD ul_reason_for_call,
LPVOID lpReserved )
{
switch (ul_reason_for_call)
{
case DLL_PROCESS_ATTACH:
{
hDll = (HINSTANCE)hModule;
break;
}
case DLL_THREAD_ATTACH:
{
break;
}
case DLL_THREAD_DETACH:
{
break;
}
case DLL_PROCESS_DETACH:
{
break;
}
default:
break;
}
return TRUE;
}
LRESULT HookProc (
int code, // hook code
WPARAM wParam, // virtual-key code
LPARAM lParam // keystroke-message information
)
{
return ::CallNextHookEx(g_hHook, code, wParam, lParam);
}
bool MYDLL_API InjectEnable()
{
g_hHook = SetWindowsHookEx( WH_CBT, (HOOKPROC)HookProc, hDll, NULL );
if( g_hHook == NULL )
{
return false;
}
return true;
}
bool MYDLL_API InjectDisable()
{
UnhookWindowsHookEx( g_hHook );
g_hHook = NULL;
// Send a broadcast message, this forces the hook to trigger, and thus unload
SendMessage(HWND_BROADCAST,WM_NULL,0,0);
return true;
}
// DLL header file:
#ifdef MYDLL_EXPORTS
#define MYDLL_API __declspec(dllexport)
#else
#define MYDLL_API __declspec(dllimport)
#endif
bool MYDLL_API InjectEnable();
bool MYDLL_API InjectDisable();
|
|
|
|
|
I'm not so sure why, but when I commented out the MessageBox in the main program, it did not crash. It installed and removed the hook successfully (to my knowledge). I have another problem though. With the hook installed, if I try to open another program, like Internet Explorer or some kind of software, Windows Crashes. It freezes and then all my icons dissappear and the taskbar goes away, leaving only the background and the cursor. Anyone have any idea why this would be happening? Any help is appreciated.
Thanks in advance
-Dev578
|
|
|
|
|
As an exercise, I am wrapping some of the lower level win32 structures and methods into a C++ object library.
I'd like to avoid forcing the user to do things like "register" classes. I think this is error prone to have the user make 'one' time calls, so I am trying to take advantage of C++ static properties. Currently, I declare an class (static) ATOM and initialize it with a function that is local to the cpp file.
My question revolves around the HINSTANCE member of the WNDCLASSEX struct. It clear that for win2k+, the hinstance parameter is ignored in the CreateWindowEx function - but what about for the population of WNDCLASSEX and subsequent RegisterClassEx calls?
It seems to work in my demo application (using WNDCLASSEX.hInstance = NULL that is). I have also had luck using the return value of GetModuleHandle.
Any suggestiong? I'd like to know whats going on under the hood. Will these methods work in simple cases and not more complex? I've even done this in a small DLL and seemed to have no problems using absolutely no HINSTANCE in the WNDCLASSEX ....
When one registers a class, is it registered systemwide? so that any HINSTANCE could instantiate it? The documentation says the WNDPROC must exist in the HINSTANCE. When I don't provide a hinstance, maybe it assumes the hinstance the call is being made from and so far, my WNDPROC always exists there?
This all comes back to the question, should I force the user to provide a HINSTANCE and consequently, Register classes explicitly.
Any direction would be appreciated.
Thanks in advance,
-Luther
|
|
|
|
|
Hi Luther,
I can only answer some of the questions you've put here. Hopefully someone else will jump in and answer the remainder.
Regarding HINSTANCE
I only know what's available in MSDN and the platform SDK, and these don't cover what goes on "under the hood" for functions like RegisterClassEx and CreateWindowEx. From experience, using NULL for the HINSTANCE doesn't seem to make much difference (but you already knew that). I don't know the consequence of using NULL for the HINSTANCE in these functions.
HINSTANCE can be important for other things though. One example is the TBADDBITMAP structure for a toolbar must get a real HINSTANCE value (not NULL) to create the toolbar.
The bottom line is that you will probably find you'll need the HINSTANCE of your application to do some things, but you'll get away with NULL for some others. Not a very adequate answer, but there you go.
Regarding RegisterClassEx
You need to call this in your application before it creates a normal window. The name registered for the window is not global, each application needs to register the windows before creating it. Using NULL as the HINSTANCE doesn't make it global or system wide.
Some predefined window types don't need to be registered. These include dialogs, edit controls, tool bars, status bars and so forth. All "general purpose" windows, however, need to be registered in the application that uses them.
By the way, you might find my article "Win32 Framework for SDI Applications" a handy reference. The URL is: http://www.codeproject.com/win32/Framework.asp
regards,
David
If it was easy, anyone could do it.
|
|
|
|
|