|
Also try PostMessage instead of SendMessage.
Mark
|
|
|
|
|
Hi,
No it did not help
Please guide me with something else instead.
Prithaa
|
|
|
|
|
prithaa wrote: I pass the 'this' pointer to my routine and print on the window which I got through the File-New command in the menu
Sounds like maybe you are drawing on the frame window? You need to draw on the view window.
Try GetActiveView() to get the window to draw on.
Mark
|
|
|
|
|
Hi Mark,
Thanks for the help
It worked,I tried GetAvtiveView()and it worked.
Bye
|
|
|
|
|
i dont know but i think in the hook i have detours 1.5 and in microsoft visual basic include folder there might be detours 2.1 arent they conflicting themselfes ?
detours library yes i have look at the includes :
[code]/
in main.cpp i have :
#include <windows.h>
#include <stdio.h>
#include "main.h"
#include "opengl.h"
#include "detours.h"
#pragma warning(disable:4100)
#pragma comment(lib,"detours.lib")
void WINAPI glDrawElements_Detour(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices);
void WINAPI glDrawElements_Trampoline(GLenum, GLsizei, GLenum, const GLvoid *indices);
bool WINAPI DllMain(HMODULE hDll, DWORD dwReason, PVOID pvReserved)
{
if(dwReason == DLL_PROCESS_ATTACH)
{
DetourFunctionWithTrampoline((PBYTE)glDrawElements_Trampoline,(PBYTE)glDrawElements_Detour);
hTtnDll = hDll;
DisableThreadLibraryCalls(hDll);
sycoreReDirectFunction("kernel32.dll", "GetProcAddress", (DWORD)&pGetProcAddress);
return TRUE;
}
return FALSE;
}
////////////// in opengel.cpp i have
#include <windows.h>
#include <stdio.h>
#include <stdarg.h>
#include <time.h>
#include <gl gl.h="">
#include <gl glu.h="">
#include <gl glaux.h="">
#include <math.h>
#include "CRC.h"
#include "ASM_GL_CALLS.h"
#include "opengl.h"
#include "main.h"
//#pragma warning(disable: 4244)
#include "detours.h"
#pragma warning(disable:4100)
#pragma comment(lib,"detours.lib")
DETOUR_TRAMPOLINE(void WINAPI glDrawElements_Trampoline(GLenum, GLsizei, GLenum, const GLvoid *indices), glDrawElements);
void WINAPI glDrawElements_Detour(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices)
{
if (MODELS_1)
{
show_****_modelz();
}
if (MODELS_2)
{
show_****_modelz();
}
if (MODELS_3)
{
show_****_modelz();
}
if (MODELS_4)
{
show_****_modelz();
}
glDrawElements_Trampoline(mode, count, type, indices);
}
and in opengel.h i have this void APIENTRY omfg_glDrawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices);
/[code]
and i get this error and i dont know what do to :::
Linking...
main.obj : error LNK2001: unresolved external symbol "void __stdcall omfg_glDrawElements(unsigned int,int,unsigned int,void const *)" (?omfg_glDrawElements@@YGXIHIPBX@Z)
Release/BASE_GL_HOOK.dll : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.
BASE_GL_HOOK.dll - 2 error(s), 0 warning(s)
i think this is right using ?
typedef void (*void WINAPI glDrawElements_Detour) ();
typedef void (*void WINAPI glDrawElements_Detour) (GLenum mode, GLsizei count, GLenum type, const GLvoid *indices);
or is this :
typedef void (WINAPI *glDrawElements_t) (GLenum mode, GLsizei count, GLenum type, const GLvoid *indices);
glDrawElements_t glDrawElements_Detour;
|
|
|
|
|
You give a header for your function omfg_glDrawElements but there is no body. You need to provide a body for this function.
Did you post all your code ? Because it is weird... And, btw, use the pre or code tags when you post code.
|
|
|
|
|
ok but void APIENTRY omfg_glDrawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices);
how to do a a body for it that not gives me errors ? and this function is hooked i think or should i write in opengl.h void WINAPI glDrawElements_Detour(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices); insted off omfg_......
-- modified at 4:13 Tuesday 24th October, 2006
this is hooked in opengel.h i dont know how to detour it it needs to be hooked and also detoured how do i do this thats the point !
|
|
|
|
|
Is that a function that is defined by yourself ? Or is it part of a library ?
If it is written by yourself, and you if you call this function, the nyou will get this linker error if there is no body defined with the function (you just provided a prototype, so now you actually need to writte the function itself, which is called the body).
But I don't really understand what you did because your code is totally unclear. Could you post the code that is related to this function ? And use the correct tags so that it is more readable.
|
|
|
|
|
yes the function is defined bymyself and it is not part of a library and i cant post the whole source code coz im not in home il get friday night or saturday to home then well see about that greeetz for helping me and if u wanna please add me my msn is ivor99@hotmail.com then we could talk .
|
|
|
|
|
I was wondering how do I get text out of a textbox and use that as the filename? I'm making a program that keeps track of people and want to have their username as the file name, so each user has his/her own file.
|
|
|
|
|
try EM_GETLINE or WM_GETTEXT
|
|
|
|
|
stream = freopen( this->textBox1->Text, "w", stderr );
thats the line I tried, where would I put that?
|
|
|
|
|
im making a program that will list all the files in several dir. they all list except the Temporary Internet Files dir. and i know as of now there is 951 files any one know why it wont and how to make it list them to?
|
|
|
|
|
use
SHGetSpecialFolderPath()
clsid of "Temporary Internet Files" is
CSIDL_INTERNET_CACHE
after getting the path
you can use
FindFirstFile ()
FindNextFile()
I will help
|
|
|
|
|
use
SHGetSpecialFolderPath()
clsid of "Temporary Internet Files" is
CSIDL_INTERNET_CACHE
after getting the path <--- i made it that far but the rest is a weeeeee bit over my headand there is a catch its not just 1 dir. there is 3 of them on my pc
C:\\Documents and Settings\\jack\\Local Settings\\Temporary Internet Files
C:\\Documents and Settings\\Administrator\\Local Settings\\Temporary Internet Files
C:\\Documents and Settings\\Default User\\Local Settings\\Temporary Internet Files
i want to scan all 3 but i can only get the path to the first one.
|
|
|
|
|
Hi,
You can use API from Wininet:
FindFirstUrlCacheEntry
FindNextUrlCacheEntry
FindCloseUrlCache
-----------
Mila
|
|
|
|
|
Hi all,
Who can help me for my below question? I will appriciate that.
In my MFC project, I used RichEdit replacing RichEdit2, but the color of the text are shifted one unit.
My code:
CString strings[3] = {_T("Apple"), _T("Orange"), _T("Pear")};
for (int i = 0; i < 3; i ++)
{
CHARFORMAT2 cf;
m_richEditCtrl.GetSelectionCharFormat(cf);
if ( i % 2 == 0 )
{
cf.crTextColor = (DWORD) RGB(255, 0 , 0); // Red color
}
else
{
cf.crTextColor = (DWORD) RGB(0, 0, 225); // Blue color
}
cf.dwEffects = static_cast<dword>(~CFE_AUTOCOLOR);
cf.dwMask = CFM_COLOR;
long length = m_richEditCtrl.GetTextLength();
m_richEditCtrl.SetSel(length, -1);
m_richEditCtrl.ReplaceSel(strings[i]);
long newLength = m_richEditCtrl.GetTextLength();
m_richEditCtrl.SetSel(length, newLength );
m_richEditCtrl.SetSelectionCharFormat(cf);
}
When I used RichEdit1 the program works perfect, but after I used RichEdit2 the color of text shows weird.
Accordding to the code, "Apple" should show red color, "Orange" should show blue color, "Pear" should show red color again. However, the actual text color are: letters "Apple" are red, "O" is red too, "range pe" are blue , and "ar" are red. That doesn't make any sense....
Is there anyone can help me on that?
Thanks!
David Zuo
|
|
|
|
|
Should this line
m_richEditCtrl.SetSel(length, newLength );
be
m_richEditCtrl.SetSel(length, newLength - 1 );
??
|
|
|
|
|
I tried m_richEditCtrl.SetSel(length, newLength - 1 ), but it still doesn't work well. Actually, what I found is RichEdit2 considers '\n' as two symbols - "\r\n", so if we use
m_richEditCtrl.SetWindowText("12345\n");
int length = richEditCtrl.GetWindowText(); // the actual value of length equals to 7, not 6.
Again, if we have
m_richEditCtrl.SetWindowText("12345\n67890");
int length = richEditCtrl.GetWindowText(); // equals to 12, not 11.
richEditCtrl.SetSel(0, 6);
m_richEditCtrl.SetSelColor(Red); // pseudo-code
m_richEditCtrl.SetSel(7, -1); // This function doesn't set correct text
m_richEditCtrl.SetSelColor(Blue); // pseudo-code
/// The actual text color is, "123456" is red, "7890" is blue
/// If you put more letters and '\n' into the string, you will find the text color shifts more than you think
but, if we use
m_richEditCtrl.SetWindowText("12345\n67890");
int length = richEditCtrl.GetWindowText(); // equals to 12, not 11.
richEditCtrl.SetSel(0, 5);
m_richEditCtrl.SetSelColor(Red); // pseudo-code
m_richEditCtrl.SetSel(6, -1);
m_richEditCtrl.SetSelColor(Blue); // pseudo-code
/// program now works well
What I found is, the number of the selected text SetSel() function shifts that equals to the number of '\n' being used in the string. Is it weird?
Most time I cann't understand why Microsoft still recommand us to use Visual C++, MFC is too old to use. They always use very weird way to do some crazy things. Doesn't make any sense! Furthermore, so manys bugs are found in MFC library, it seems Microsoft never tested their APIs before they released them.
David Zuo
|
|
|
|
|
Glad you got it working. I never saw any newlines (\n) in your original code
David.YueZuo wrote: Furthermore, so manys bugs are found in MFC library, it seems Microsoft never tested their APIs before they released them.
Wow what MFC version are you using? MFC works as documented for me (Version 7.11).
David.YueZuo wrote: MFC is too old to use
So use .NET! Better yet, use Windows APIs directly!
I didn't know Microsoft "recommand us to use Visual C++" either.
This is all news to me, thanks!
Mark
|
|
|
|
|
LOL..thx for your suggestions, i will keep that in my mind.
Unfortunately, my team have to use VC++ since they started using it at 1998.
Maybe I should get my job changed, how about become to a java developer, would be better?
hahaha...
David Zuo
|
|
|
|
|
Hi all,
Using VC++ 6 with MFC.
What I'm trying to do is have a secondary modeless dialog which can be attached to the main dialog and detached again, similar to winamp. The way I'm thinking of implementing this is having two dialog classes for the main and modeless dialogs, and one dialog resource with the actual controls etc (child, no title bar etc.), similar to the way you use a CTabCtrl.
I want the 'Screen' dialog resource to be loaded into either the secondary or primary dialog based on user input, possibly by replacing a static control?
How can I implement this?
Thanks
Bob
|
|
|
|
|
Some helpful APIs for this are
ShowWindow() to hide/show windows/dialogs
MoveWindow() to resize/reposition child windows
GetWindowRect() to get a window's position relative to screen
MapWindowPoints() to translate screen coordinates to parent-window-relative coordinates
SetParent() to "move" a child window between parents
Using an invisible (no WS_VISIBLE style) static control is an easy way to find the rect for
positioning a child window on a dialog.
Mark
|
|
|
|
|
Im not sure its helpful for you or no but you can see an example of david crow about resources
|
|
|
|
|
Hi,
I have a cdialog window which contains a webbrowser activex control. I want to be able to select some text from a control on the dialog (but not inside the webbrowser), and drag it into a textarea element within the webbrowser control. How do I do this? Can someone point me in the right direction?
Thanks,
derek
|
|
|
|
|